redhat-developer / redhat-developer/vscode-yaml
Referenced schemas don't seem to be using base URL?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 829
- Forks
- 260
- Avg merge
- 5h 43m
- Merged PRs (30d)
- 1
Description
Summary
Schemas don't seem to follow child references relative to parent reference base uri
Relevant information
I have a as schema that has some properties referencing other schemas via $ref using a relative path. But the document I'm trying to validate is returning an error stating that schema could not be loaded and the path that it shows seems to be relative to root, not relative to the first schema. For example
- Doc uses
$schema=c:\user\me\docs\foo.schema.json foo.schema.jsonhas a property reference"$ref": "bar.schema.json"- Doc shows a validation error
'Problems loading reference 'file:///bar.schema.json': Unable to load schema from\bar.schema.json`: No content.
The schema files are co-located; same directory.
I'm not sure if I'm doing something wrong or if it's not supported or a bug or what
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the validation failure with the co-located foo.schema.json and bar.schema.json files described in the issue, where foo.schema.json references bar.schema.json. Start by tracing schema reference resolution during document validation. Done means the relative $ref resolves beside foo.schema.json instead of being treated as relative to the root.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100