-
Notifications
You must be signed in to change notification settings - Fork 14
feat(ipa): new IPA rule xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf #893
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
Conversation
}, | ||
oneOf: [{}], | ||
}, | ||
SchemaAnuOf: { |
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.
[nit] SchemaAnyOf
return evaluateAndCollectAdoptionStatus(errors, rule.name, siblings, path); | ||
}; | ||
|
||
function checkViolationsAndReturnErrors(input, path, siblingKeys) { |
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.
Which Swagger component annotation level are we able to define exceptions? Is it Schema?
Should we update the component level for metrics collection?
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.
Yes, the schema. The exceptions are siblings to the discriminator since discriminators cannot have extensions.
Now the metric path is ['components', 'schemas', 'SchemaName', 'discriminator']
- no strong opinion to have it or remove the discriminator
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 think we can remove the discriminator
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.
Done!
Proposed changes
New IPA rule validates that a
discriminator
property is always accompanied byoneOf
,allOf
oranyOf
.Note: The exception level is on the schema itself, since we can't put extensions on the discriminator object.
Current violations: 23. Will add exceptions/corrections in follow-up
Jira ticket: CLOUDP-308542