ngx-schema-form icon indicating copy to clipboard operation
ngx-schema-form copied to clipboard

Display form data from an array of objects

Open dlaugh14 opened this issue 6 years ago • 3 comments

Schema - { "type": "object", "title": "Types", "properties": { "termsAndConditions": { "type": "array", "items": [ { "type": "object", "properties": { "choice": { "type": "boolean", "title": "I agree to receive an autodialed call from an agent who can help me schedule my service installation:", "enum": [ true ] } }, "required": [ "choice" ] }, { "type": "object", "properties": { "choice": { "type": "boolean", "title": "Second agreement" } }, "required": [ "choice" ] } ], "minItems": 2, "maxItems": 2 } }, "required": [ "termsAndConditions" ] };

This schema seems to come back as a button. We're considering using this library, but our team needs to be able to dynamically insert data into the schema via an array. Is it possible to get this to display or what changes need to be made. The above example would be two agreement checkboxes.

dlaugh14 avatar Apr 20 '18 16:04 dlaugh14

The items object should not be an array. This schema is not correct.

Did you mean the oneOf array? In this case, take a look at this issue: https://github.com/makinacorpus/angular2-schema-form/issues/198

WhileTrueEndWhile avatar May 12 '18 09:05 WhileTrueEndWhile

That schema is valid array tuple, as per https://json-schema.org/understanding-json-schema/reference/array.html?highlight=tuple#tuple-validation

Facing the same problem with a similar schema.

acazau avatar Sep 03 '18 21:09 acazau

Many thanks for the correction, especially after this long time! The question is now rather whether this is supported...

WhileTrueEndWhile avatar Sep 07 '18 08:09 WhileTrueEndWhile