Skip to content

Support for references between definitions #142

@eleumik

Description

@eleumik

Hi,
Thank you for your great work, I have an issue:

if a schema contains a definition that references an other definition the editor attempts to resolve the reference with HTTP or with the [refs] configuration object but, I believe,it should attempt to resolve it first internally.

If I give to the editor the JSON-schema at the bottom of this message, in which a root schema references a Child type that has a field that references a Child2 type, the editor attempts to resolve the Child2 type reading the URL given resolving the fragment identifying the Child2 schema against the URL of the page, eg: http://127.0.0.1:8080/mm/jexample.jsp#/definitions/Child2 (BTW is there any way to set the base URL ? could use id ? [1] [2])

However if I configure a refs object with the right schema it works, something like this:

  refs : {'#/definitions/Child2' : schema.definitions.Child2}

produces the following form:

A picture of the form

Maybe I am doing something wrong but if I am not I think this is related to #128 #127 #115 but IMHO could be easier to fix (since already works with refs) and maybe a starting point in supporting the others .. I tried to look into it but no luck...

 var schema =        {
    "id" : "http://example.org/",
    "title" : "Test Complex Field",
    "type" : "object",
    "properties" : {
        "MyComplexField" : {
            "$ref" : "#/definitions/Child"

        }
    },
    "definitions" : {
        "Child" : {
            "properties" : {
                "childComplex" : {
                    "$ref" : "#/definitions/Child2"

                },
                "label" : {
                    "type" : "string",
                    "default" : "ciao"
                }
            },
            "type" : "object"
        },
        "Child2" : {
            "properties" : {
                "aNumber" : {
                    "type" : "integer"

                }
            },
            "type" : "object"
        }
    }

}

[1] http://json-schema.org/latest/json-schema-core.html#anchor29
[2] http://jsonary.com/documentation/json-schema/?section=keywords/Referencing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions