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
607 stars 168 forks source link

$ref? #61

Open fabifabi opened 7 years ago

fabifabi commented 7 years ago

$ref should do an ajax call (with id of the schema?)

but actually : function getDefinition(path) { var parts = path.split('/'); var def = root; for (var p in parts) { if (p === "0") continue; def = def[parts[p]];

        }
        return def;
    }

i dont understand well what that's doing ! how that's work ? sorry it is more a question than an "issue" perhaps, feel free to close it.

idelvall commented 7 years ago

It's doing that http://brutusin.org/json-forms/#11 referencing a definition contained in your actual schema.

Currently If you have different schemas definitions (accessible from HTTP or whatsoever) you can build these superschema in a preprocessing step, although it should not be difficult to add some mechanisms to the library (callback?) to let the user resolve definitions in case they are not present (this is where your ajax calls would be used)

fabifabi commented 7 years ago

Hum i understand how to do but will be nice if it is done by the library i think.

idelvall commented 7 years ago

working on this...

mastercoding commented 7 years ago

Any news regarding this enhancement @idelvall?

idelvall commented 7 years ago

Yes, I forgot to include the follow up. In case of referencing an schema that is not present in your definitions, the schema resolver is invoked. In other words you should create an schema resolver for the form that would make those AJAX calls as needed.