-
Notifications
You must be signed in to change notification settings - Fork 12
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
Support type property as an array, according to JSON Schema Validation #13
base: master
Are you sure you want to change the base?
Conversation
In JSON Schema, the "type" property may be a string or an array of strings. Previously, if type was set as array of strings (i.e., `"type": ["null", "array"]`) and there was also an "items" property defining the array as items of type "integer," then bootprint-json-schema would render the following: null,array Additionally, the "items" property was not rendered. The expected result for the given scenario is: null, integer[] And the "items" property should be rendered with its defintion. This supports the JSON Schema "type" as it is defined to allow an array of strings. If one of the strings in that array is "array," then `items.type` is used to render the datatype, and the "items" property is also rendered.
Interesting. I didn't know about multiple types. I have to read about that...
What about "null, object"? That should be dealt with as well, shouldn't it?
Would be great if you could add a test that covers the new lines.
And it might take a few days until I have the time to review everything, but so far: Thanks for your PR
Am 28. März 2017 23:47:10 MESZ schrieb Ben Ramsey <[email protected]>:
…In JSON Schema, the ["type"
property](https://tools.ietf.org/html/draft-wright-json-schema-validation-00#section-5.21)
may be a string or an array of strings. Previously, if type was set as
array of strings (i.e., `"type": ["null", "array"]`), then
bootprint-json-schema would render the following:
null,array
Additionally, the "items" property was not rendered.
The expected result for the given scenario is:
null, integer[]
And the "items" property should be rendered with its schema definition.
This supports the JSON Schema "type" as it is defined to allow an array
of strings. If one of the strings in that array is "array," then
`items.type` is used to render the datatype, and the "items" property
is also rendered.
You can view, comment on, or merge this pull request online at:
#13
-- Commit Summary --
* Support type property as an array, according to JSON Schema
Validation
-- File Changes --
M handlebars/helpers.js (11)
M handlebars/partials/json-schema/body.hbs (4)
-- Patch Links --
https://github.com/bootprint/bootprint-json-schema/pull/13.patch
https://github.com/bootprint/bootprint-json-schema/pull/13.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#13
--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
|
This should handle all cases, so I'll provide test cases soon. I thought I saw you mention on another PR that you hadn't yet set up the testing infrastructure, so I skipped over writing tests, since I wasn't sure the status of that. I could have been confused with another project I was working on. :-) |
You are right. There was such a PR. I set up the infrastructure before the merge and used it to write a test for that PR.
Am 29. März 2017 20:52:38 MESZ schrieb Ben Ramsey <[email protected]>:
…This should handle all cases, so `null, object[]` should work. I only
used `null, integer[]` as an example.
I'll provide test cases soon. I thought I saw you mention on another PR
that you hadn't yet set up the testing infrastructure, so I skipped
over writing tests, since I wasn't sure the status of that. I could
have been confused with another project I was working on. :-)
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#13 (comment)
--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
|
bump? I hit a roadblock and was happy to find this fork exists and fixed my issue. It solves the [array, null] issue well |
This change still needs a test. This can be something like the fstab-spec. Should not be too hard to write... |
In JSON Schema, the "type" property may be a string or an array of strings. Previously, if type was set as array of strings (i.e.,
"type": ["null", "array"]
), then bootprint-json-schema would render the following:Additionally, the "items" property was not rendered.
The expected result for the given scenario is:
And the "items" property should be rendered with its schema definition.
This supports the JSON Schema "type" as it is defined to allow an array of strings. If one of the strings in that array is "array," then
items.type
is used to render the datatype, and the "items" property is also rendered.