brutusin / json-forms

JSON Schema to HTML form generator, supporting dynamic subschemas (on the fly resolution). Extensible and customizable library with zero dependencies. Bootstrap add-ons provided
http://brutusin.org/json-forms
Apache License 2.0
606 stars 168 forks source link

Issue resolving parent properties #104

Open sathishk opened 6 years ago

sathishk commented 6 years ago

I have 3 schemas (A, B and C). each has one property each. Where as C is referencing B and B is referencing A. A is Parent, B is child and C is grandchild. Below is the schema.

{
    "$schema": "http://json-schema.org/draft-06/schema#",
    "id": "C",
    "type": "object",
    "$ref": "#/definitions/B",
    "definitions": {
        "A": {
            "$schema": "http://json-schema.org/draft-06/schema#",
            "id": "A",
            "type": "object",
            "properties": {
                "A-Prop": {
                    "type": "string"
                }
            }
        },
        "B": {
            "$schema": "http://json-schema.org/draft-06/schema#",
            "id": "B",
            "type": "object",
            "$ref": "#/definitions/A",
            "properties": {
                "B-Prop": {
                    "type": "string"
                }
            }
        }
    },
    "properties": {
        "C-Prop": {
            "type": "string"
        }
    }
}

When i pass this to the json-form i expect to all the 3 properties . but i see only the property of A as given below

screen shot 2017-09-21 at 7 39 04 pm
KiSchulte commented 6 years ago

Mhh, whats the reason for this structure. Maybe you can describe what you want to achieve. I don't understand hwat you mean with referencing, here.

sathishk commented 6 years ago

I am doing inheritance here. I have 3 types . A, B and C. A is my Base Type . B extends A. C extends B.

So, C should have 1 property and inherit 2 from it's super types A and B respectively. In total C should have 3 properties.

For Eg, If we supply the above schema at http://jeremydorn.com/json-editor/. We get below Form

screen shot 2017-10-09 at 3 06 49 pm
KiSchulte commented 6 years ago

Ok got it. I assume you just reduced it to an easy example. I just wan't sure what you wanted ti achieve with this structure.