Support oneOf and anyOf as alternative of enum/enumNames#581
Support oneOf and anyOf as alternative of enum/enumNames#581glasserc merged 6 commits intorjsf-team:masterfrom
Conversation
glasserc
left a comment
There was a problem hiding this comment.
This is fantastic work, thanks! My only real complaints:
-
isConstantcould use some JSDoc saying that it's used on schemas (maybe something like "Checks to see if a schema only matches a single constant value") -
isSelectprobably needs a better name and/or JSDoc. (Maybe the name is OK sinceisMultiSelectexists, although I'm not crazy about that name either.)
Sorry it took so long to look at this!
| }); | ||
| }); | ||
|
|
||
| it("should retrieve reference schema definitions", () => { |
src/utils.js
Outdated
| return false; | ||
| } | ||
| const itemsSchema = retrieveSchema(schema.items, definitions); | ||
| return isSelect(itemsSchema); |
There was a problem hiding this comment.
How about isSelect(schema.items, definitions) instead?
|
Currently there isn't any JSDoc comment in the react-jsonschema-form sources. Should I add a simple comment or a JSDoc comment ? |
|
We don't have any code that does anything specific with JSDoc comments and actually most functions are not documented using JSDoc, but adding a JSDoc comment is fine. It doesn't have to be complicated -- the example on validateFormData is fine. |
|
@glasserc, I made all the requested changes except the renaming of |
|
Thanks! |
|
Released in v0.50.0. |
Reasons for making this change
As mentioned by @dlax in #532 enumNames keyword is not in the JSON Schema specification (neither draft-04 nor draft-06).
Another way to support choices schemas is to write them with the following structure :
or with draft-06's new
constkeyword:This PR adds basic support for oneOf/anyOf as an alternative to the non standard
enumNameskeywords.Checklist
npm run cs-formaton my branch to conform my code to prettier coding style