eclipsesource / jsonforms

Customizable JSON Schema-based forms with React, Angular and Vue support out of the box.
http://jsonforms.io
Other
2.03k stars 352 forks source link

Support Bundling json schema #2334

Open roy20021 opened 2 months ago

roy20021 commented 2 months ago

Is your feature request related to a problem? Please describe.

Hello,

I have an endpoint returning a "compound document schema" so a bundling of many schemas and I would like to render the related form accordingly.

References:

  1. https://json-schema.org/understanding-json-schema/structuring#bundling
  2. https://json-schema.org/blog/posts/bundling-json-schema-compound-documents

JsonSchema Example (from links above): { "$id": "https://example.com/schemas/customer", "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "first_name": { "type": "string" }, "last_name": { "type": "string" }, "shipping_address": { "$ref": "/schemas/address" }, "billing_address": { "$ref": "/schemas/address" } }, "required": ["first_name", "last_name", "shipping_address", "billing_address"], "$defs": { "address": { "$id": "/schemas/address", "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "street_address": { "type": "string" }, "city": { "type": "string" }, "state": { "$ref": "#/definitions/state" } }, "required": ["street_address", "city", "state"], "definitions": { "state": { "enum": ["CA", "NY", "... etc ..."] } } } } }

Data: { "first_name": "FirstName", "last_name": "LastName", "shipping_address": { "street_address": "StreetAddress", "city": "City", "state": "NY" }, "billing_address": { "street_address": "StreetAddress2", "city": "City2", "state": "CA" } }

Currently, only "first_name" and "last_name" are displayed. Instead, "shipping_address" and "shipping_address" are not shown at all.

Describe the solution you'd like

I would like that JsonForm works properly and render the form according to the given json schema and data

Describe alternatives you've considered

I have tried to use json-refs and json-schema-ref-parser as preprocessing the schema but it is already fine.

Framework

Vue

RendererSet

Vanilla

Additional context

No response

sdirix commented 2 months ago

Hi @roy20021,

Thanks for the suggestion. Currently we don't support compound document schemas. I will add this request to "next". However we will not work on this feature in the foreseeable future except it's requested via sponsored development. If you, or someone else, is willing to contribute support for compound schemas then we are definitely interested. In that case I would like to suggest to build a small POC to evaluate the impact on the code base before diving into the full implementation,