-
Notifications
You must be signed in to change notification settings - Fork 14
feat(ipa): New rule xgen-IPA-125-oneOf-schema-property-same-type #873
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
}, | ||
}, | ||
], | ||
'x-xgen-IPA-exception': { |
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.
Q: If the exception is defined at the schema level (via Swagger annotations), should the tracked path for exceptions also point to the schemas?
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.
Not sure I understand the question, could you clarify? Do you mean the path passed to the metrics?
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, I’m trying to confirm whether the path passed to metrics should be the schema path where the exception is defined, or if we’re instead passing the oneOf
path
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 exception path is to oneOf
. Since the adoption and violation are on the oneof
path, it makes sense for the exception to be on the same path as well. Also, exceptions cannot be on the oneOf object, so therefore it's on the schema level
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.
So my suggestion is that we can collect adoption status on schema level instead of oneOf level, because the exception is also defined on the schema level. What do you think?
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.
Sure, 👍
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.
LGTM, thanks!
Proposed changes
Adds new warning-level rule checking that properties with the same name in oneOf schemas are of the same type.
If the property is a base type, it should have the same
type
is all oneOf schemas. If the property is of object type, it should have the same schema in all oneOf schemas.Current violations:
Jira ticket: CLOUDP-309117