angular-schema-form-bootstrap icon indicating copy to clipboard operation
angular-schema-form-bootstrap copied to clipboard

tv4 Required / Additional Properties Errors with latest alpha 4

Open mark007 opened this issue 8 years ago • 0 comments

Enhancement

As a user/developer, when I use asf-bootstrap alpha 4 with a schema with arrays of objects

Expected behaviour

I expected the form to validate

Actual behaviour

It actually see either "Required" error at the bottom of the form (which looks like tv4) or errors about Additional Fields depending on if I give default values or not.

Gist/Plunker/Demo

I'm not sure the easiest way to bring these in with plunker / gist so I have pasted the example schema below. Which has additionalProperties false for each object, and also does not have default values for some keys. Both of these cause me to not be able to get a valid form.

{ "$schema": "http://json-schema.org/draft-06/schema#", "additionalProperties": false, "type": "object", "properties": { "vms": { "type": "array", "items": { "additionalProperties": false, "type": "object", "properties": { "hostname": { "description": "This must be a valid hostname", "pattern": "^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$", "type": "string" }, "users": { "additionalProperties": false, "type": "object", "properties": { "username": { "type": "string", "default": "admin" }, "password": { "type": "string", "default": "admin" }, "type": { "type": "string", "default": "admin" } }, "required": [ "username", "password", "type" ] }, "active": { "title": "Active", "type": "boolean", "default": false } }, "required": [ "ip", "hostname", "active", "users" ] } } }, "required": [ "vms" ] }

@json-schema-form/angular-schema-form-bootstrap-lead

mark007 avatar Oct 25 '17 10:10 mark007