CesiumGS / wetzel

Generate Markdown documentation from JSON Schema
Apache License 2.0
133 stars 54 forks source link

Relative `$ref`s are always resolved against root schema path (?) #83

Open rijenkii opened 2 years ago

rijenkii commented 2 years ago

I'm not sure if it's the intended behaviour, but it feels like it shouldn't be.

./main.json:

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "title": "main",
    "$ref": "./subdir/child1.json"
}

./subdir/child1.json:

{
    "title": "child1",
    "$ref": "../child2.json"
}

./child2.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.