Relative `$ref`s are always resolved against root schema path (?)
- Dominant language
- JavaScript
- Stars
- 137
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Description
I'm not sure if it's the intended behaviour, but it feels like it shouldn't be.
`./main.json`:
```json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "main",
"$ref": "./subdir/child1.json"
}
```
`./subdir/child1.json`:
```json
{
"title": "child1",
"$ref": "../child2.json"
}
```
`./child2.json`:
```json
{
"title": "child2",
"type": "string"
}
```
`wetzel main.json` fails with `Error: Unable to find $ref ../child2.json`, but works if I change the `$ref` in child1 to `./child2.json`, as if child1 is located in the same directory as child2.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure with main.json, subdir/child1.json, and child2.json using `wetzel main.json`; compare it with the working `./child2.json` reference. Trace the CLI's `$ref` resolution entry point and verify that a reference in child1.json is resolved relative to child1.json's directory, so the command completes successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100