Skip to content

Add normalizer rule for required on allOf #408

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

Closed
wants to merge 2 commits into from

Conversation

pondpiu
Copy link

@pondpiu pondpiu commented Sep 19, 2021

Addressing #395 as per @ackl suggestion

Copy link
Owner

@bcherny bcherny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution and sorry for the delay in getting back to this. Commenting in #395.

@@ -145,6 +145,15 @@ rules.set('Transform const to singleton enum', schema => {
}
})

rules.set('Spread required on allOf into its subSchema', schema => {
if (schema.allOf && schema.required) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll also want to consider:

  • anyOf and oneOf
  • Nested sub-schemas N layers deep

title: 'MergeRequiredFromAllOf',
type: 'object',
properties: {
reference: {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when there's a second property that also references #/definitions/defined, but doesn't have the required?

@bcherny
Copy link
Owner

bcherny commented May 4, 2023

Closing out stale PRs. If you'd like to revisit this, feel free to re-open.

@bcherny bcherny closed this May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants