Support type property as an array, according to JSON Schema Validation#13
Open
ramsey wants to merge 1 commit intobootprint:masterfrom
ramsey:fix-schema-type-array
Open
Support type property as an array, according to JSON Schema Validation#13ramsey wants to merge 1 commit intobootprint:masterfrom ramsey:fix-schema-type-array
ramsey wants to merge 1 commit intobootprint:masterfrom
ramsey:fix-schema-type-array
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.
Member
|
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 <notifications@github.com>:
…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.
|
Contributor
Author
|
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. :-) |
Member
|
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 <notifications@github.com>:
…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 |
Member
|
This change still needs a test. This can be something like the fstab-spec. Should not be too hard to write... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.typeis used to render the datatype, and the "items" property is also rendered.