Conversation
|
Hey @bcherny, this should do the trick to support boolean JSON schemas. Do you have any test cases in mind? I added a couple of cases but I'm open to add / remove more :) |
| return parseBooleanSchema(schema, keyName, options) | ||
| } | ||
|
|
||
| return parseLiteral(schema, keyName) |
There was a problem hiding this comment.
tbh I don't know what to do here. In theory we should omit anything at this point instead of parsing the literal, but I don't want to introduce too many changes in this PR
There was a problem hiding this comment.
Could be a little cleaner to move the parseBooleanSchema into parseLiteral, since true/false are literals.
There was a problem hiding this comment.
I think this would be a mistake. Parsing true and false as schemas is not the same as parsing them as values. Depending on the context, true and false are schemas or values.
A simple example would be the true boolean schema vs a true enum value. They should not be parsed as the same.
| return parseBooleanSchema(schema, keyName, options) | ||
| } | ||
|
|
||
| return parseLiteral(schema, keyName) |
There was a problem hiding this comment.
Could be a little cleaner to move the parseBooleanSchema into parseLiteral, since true/false are literals.
|
Hey @bcherny, when adding the root boolean schema case, it seems the ref parser can not dereference it, it throws an error instead. I can have a look at it, but seems the parser is expecting an object instead of a boolean value. Would it be ok if I submit a pr in the parser repo? I think some sort of conditional logic to handle boolean schemas would do the trick. |
bcherny
left a comment
There was a problem hiding this comment.
Looks good. Thanks for the contribution!
|
Published 13.0.0. |
Added
NEVERschema type.Changed