Open fmigneault opened 5 years ago
Hi @fmigneault
It would be awesome, but unfortunately, I'm not sure that the library we're relying on to render policy configuration through the UI is able to manage this inheritance / composition / ... from json schema
@brasseld Is there a way that the UI could be reactive to a user input?
Using my previous example, a combobox/selector would offer types [Deer, Llama]
.
Upon selection of one or the other, the form to be applied would be resolved with corresponding object by ID using the normal conversion method used by http://schemaform.io/, by providing only the corresponding object's definition.
According to some of the examples, it seems to be possible.
Did you see them http://schemaform.io/examples/bootstrap-example.html ?
I see, yes it does seem possible according to these examples to make conditional forms. I am wondering though how these conditions could be generated from the schemas alone? If I’m understanding correctly, the forms’ JSON structures are obtained from the JSON schemas generated by the maven plugin?
@brasseld I found this example that shows exactly the results that would be expected with a selector of corresponding object inputs, and the form schema that should support it.
Is there a possibility to consider using https://github.com/mbknor/mbknor-jackson-jsonSchema for https://github.com/gravitee-io/json-schema-generator-maven-plugin in order to support plugin policy JSON schema generation using class inheritance?
More specifically, it would be great to support objects using
anyOf
oroneOf
structures in cases where one object configuration or another can be specified for a given policy implementation.With below example, both
Deer
andLlama
would be valid objects that could be used to configured the same policy field.Expected Behavior
Using a selector, one of the specialization classes as defined in the JSON schema
oneOf
can be selected, and corresponding fields are displayed in the UI.On the API side, the schema validation should allow the supported cases. Appropriate extending class be enforced via an enum as proposed here: https://github.com/FasterXML/jackson-module-jsonSchema/issues/5#issuecomment-54288139
An explicit example of the expected behaviour is presented here: https://stackoverflow.com/questions/56174997/json-schema-generator-with-inheritance-and-references This example's solution uses https://github.com/mbknor/mbknor-jackson-jsonSchema proposed above.
Current Behavior
An interface class that is extended by valid classes cannot be "selected" to be specialized with appropriate type in the API management UI. The generated JSON only defines an object with type
any
, which doesn't provide specialized object fields to fill from the management API and UI.Possible Solution
see above links
Your Environment