json-schema-form / angular-schema-form

Generate forms from a JSON schema, with AngularJS!
https://json-schema-form.github.io/angular-schema-form
MIT License
2.47k stars 653 forks source link

Form generation for part of schema #991

Closed geethapriya-mc closed 5 years ago

geethapriya-mc commented 5 years ago

using schema, { "$schema": "http://json-schema.org/draft-07/schema#", "title": "VehicleSettings", "type": "object", "additionalProperties": true, "required": [ "Products" ], "properties": { "Products": { "$ref": "#/definitions/ProductsModel" } }, "definitions": { "ProductsModel": { "type": "object", "additionalProperties": true, "required": [ "Toyota", "Benz", "Icon" ], "properties": { "Toyota": { "$ref": "#/definitions/ToyotaModel" }, "Benz": { "$ref": "#/definitions/BenzModel" } } }, "ToyotaModel": { "type": "object", "additionalProperties": true, "required": [ "Capacity" ], "properties": { "Capacity": { "title": "feul capacity", "type": "string", "default": "(undefined)", "minLength": 2 } } }, "BenzModel": { "type": "object", "additionalProperties": true, "required": [ "FuelCapacity", "Milage" ], "properties": { "FuelCapacity": { "title": "Fuel Capacity", "type": "integer", "format": "int32", "default": 50 }, "Milage": { "title": "Km/hr", "type": "integer", "format": "int32", "default": 100 } } } } } As a user/developer, how should the form definition look like if i want to generate UI for only vehicleSettings.Products.Benz The generated UI form should contain FuelCapacity and Milage feilds.

Anthropic commented 5 years ago

It would only work in the alphas that have support for $ref, but if you use that then you can use a UI Schema of:

[
  "Products.Benz"
]