Skip to content

doubts about ref.json test.  #633

@redmitry

Description

@redmitry

Hello,

I have a doubt about the particular test in the test suit ref.json#L179 :

    {
        "description": "$ref prevents a sibling $id from changing the base uri",
        "schema": {
            "$id": "http://localhost:1234/sibling_id/base/",
            "definitions": {
                "foo": {
                    "$id": "http://localhost:1234/sibling_id/foo.json",
                    "type": "string"
                },
                "base_foo": {
                    "$comment": "this canonical uri is http://localhost:1234/sibling_id/base/foo.json",
                    "$id": "foo.json",
                    "type": "number"
                }
            },
            "allOf": [
                {
                    "$comment": "$ref resolves to http://localhost:1234/sibling_id/base/foo.json, not http://localhost:1234/sibling_id/foo.json",
                    "$id": "http://localhost:1234/sibling_id/",
                    "$ref": "foo.json"
                }
            ]
        },
        "tests": [
            {
                "description": "$ref resolves to /definitions/base_foo, data does not validate",
                "data": "a",
                "valid": false
            },
            {
                "description": "$ref resolves to /definitions/base_foo, data validates",
                "data": 1,
                "valid": true
            }
        ]
    }

Is the "definitions" keyword is just a convention or is a part of the specification?
I refer to the draft4 section-7.2.3
My point is that should the validator process "definitions" as the "$defs"?
If the "definitions" is just a convention, the validator should dereference it as json pointer an thus the test will FAIL because we do not process it before referencing.

Thank you,

D.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions