-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add preliminary support for the anyOf keyword #1118
Conversation
Note that the unit tests are failing due to the New year rollover, which I've fixed/band-aided in a separate PR here #1119 |
This looks good to me as a change and would be extremely useful if merged. Thanks ! :) |
@edi9999 Could you review this PR please? |
This change introduces support for the `anyOf` keyword. The keyword is NOT supported in arrays (using the `items` keyword). Options provided in the `anyOf` keyword are rendered using a new component called `AnyOfField` this can be overridden with a custom field using the `fields` property. Signed-off-by: Lucian <lucian.buzzo@gmail.com>
@edi9999 I've addressed your review comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really excited to see this! The code mostly looks good and it's got tests, thank you very much!
Documentation would be great :) In particular, I think it's worth calling out that properties provided by anyOf
should not overlap any properties from "outside" the anyOf
.
Fantastic, thanks. I'll cut 1.2.0 in a few minutes. |
Is this missing from the playground? |
@strahius I think the playground hasn't been updated, you can see it in action if you run the playground from source. |
You are right, it just hasn't been deployed yet probably. Thanks a lot, good job! |
@strahius the playground should be updated now. |
This change introduces support for the
anyOf
keyword. Other PRs that add support foranyOf
/oneOf
exist, but are stale and/or incomplete ( #302, #417, #940 ).The keyword is NOT supported in arrays (using the
items
keyword).Options provided in the
anyOf
keyword are rendered using a new component calledAnyOfField
, this can be overridden with a custom field using thefields
property.I'd like to follow-up on this PR with work to add support for
anyOf
in arrays andoneOf
. I decided against submitting that work in this PR to help keep reviews and discussion manageable.Checklist
npm run cs-format
on my branch to conform my code to prettier coding style