Skip to content

boolean values allow true only on generated schema #857

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jagould opened this issue Mar 22, 2017 · 3 comments
Closed

boolean values allow true only on generated schema #857

jagould opened this issue Mar 22, 2017 · 3 comments

Comments

@jagould
Copy link

jagould commented Mar 22, 2017

We are generated schema automatically from java pojos using jackson libraries. in that library boolean values automatically get "required", which makes sense as in java this is a primitive and so cannot contain null.

Unfortunately, forms are now generating with a checkbox that only allows "true" as the value. This appears new as it did not occur in prior versions of angular-schema-form. Also, I don't believe this matches the schema where required would allow true or false but not null.

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

@jagould
Copy link
Author

jagould commented Mar 23, 2017

Rereading my post, apologies if my ranting is unclear. So to clarify, the schema below has "myBoolean" as a required field. The generated form using the default form ["*"] displays an error when the checkbox is empty even though the underlying json value is set to false, which is valid according to the schema. This started occurring after upgrading to the latest download.

{"$schema":"http://json-schema.org/draft-04/schema#",
"title":"my_schema",
"type":"object",
"additionalProperties":true,
"properties":{
"myArray":{"type":"array","items":{"type":"string","pattern":"^\d+$"},
"description":"string of numbers","title":"numbers"},
"myBoolean":{"type":"boolean","description":"If true, do something","title":"Do Something"}},
"required":["myArray","myBoolean"]}}

@Anthropic
Copy link
Member

@jagould thanks for the report :)

I can see what you mean, I made a Gist of the working one that doesn't work in the current version to test against:
http://schemaform.io/examples/bootstrap-example.html#/3bc648fe6e7d6e3e348b396fc41f8ede

@Anthropic
Copy link
Member

This is ready to be released in the next alpha as it was a logic fail when I moved Angular specific code into the core and replaced it with code that wasn't identical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants