-
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
fix: Fixes #3808 Duplciate AnyOf/OneOf Description #3841
fix: Fixes #3808 Duplciate AnyOf/OneOf Description #3841
Conversation
// merge top level required field | ||
const { required } = schema; | ||
// Merge in all the non-oneOf/anyOf properties and also skip the special ADDITIONAL_PROPERTY_FLAG property | ||
unset(remaining, ADDITIONAL_PROPERTY_FLAG); | ||
optionSchema = !isEmpty(remaining) ? (mergeSchemas(remaining, option) as S) : option; | ||
optionSchema = required ? (mergeSchemas({ required }, option) as S) : option; |
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.
Makes sense to me, I can't think of properties other than required
that should be passed through.
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.
@cwendtxealth can you just add to new or existing tests to ensure properties
and description
aren't merged, and add a line to the CHANGELOG?
@@ -61,6 +62,8 @@ describe('anyOf', () => { | |||
expect(node.querySelectorAll('select')).to.have.length.of(1); | |||
expect(node.querySelector('select').id).eql('root__anyof_select'); | |||
expect(node.querySelectorAll('span.required')).to.have.length.of(1); | |||
expect(node.querySelectorAll('#root__description')).to.have.length.of(1); |
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.
tested without fix these will have length of 2
@@ -62,6 +63,8 @@ describe('oneOf', () => { | |||
expect(node.querySelectorAll('select')).to.have.length.of(1); | |||
expect(node.querySelector('select').id).eql('root__oneof_select'); | |||
expect(node.querySelectorAll('span.required')).to.have.length.of(1); | |||
expect(node.querySelectorAll('#root__description')).to.have.length.of(1); | |||
expect(node.querySelectorAll('#root_baz')).to.have.length.of(1); |
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.
tested without fix these will have length of 2
* update antd version to v5 from v4 * update playground * Keep peer dependency of ant to v4 * update package json of playground * update changelog.md * update docs for antd * update docs for antd * Update uiSchema.md * incorporate feedback * fix: Fixes #3808 Duplciate AnyOf/OneOf Description (#3841) * Update package.json --------- Co-authored-by: Christian Wendt <[email protected]> Co-authored-by: Heath C <[email protected]>
Reasons for making this change
Adding on to this fix, the description of the top level schema still shows in the oneOf/allOf fields.
Checklist
npm run test:update
to update snapshots, if needed.