-
Notifications
You must be signed in to change notification settings - Fork 145
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
Improve validation for Rule 240 #1245
Conversation
* Simplify code * Add a fix when `boolean` enums are validated * Add a type check for enum value types and a property type * Fix variable shadowing problem * Make `extensibleEnum` extension return `Any` instead of `String`
@tkrop this PR fixes the problem with the Rule 240 you've mentioned |
Codecov Report
@@ Coverage Diff @@
## master #1245 +/- ##
=========================================
Coverage 87.62% 87.62%
Complexity 85 85
=========================================
Files 69 69
Lines 978 978
Branches 71 71
=========================================
Hits 857 857
Misses 84 84
Partials 37 37 Continue to review full report at Codecov.
|
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.
@vadeg sorry, for the review delay. I have some questions left.
server/zally-core/src/main/kotlin/org/zalando/zally/core/util/OpenApiUtil.kt
Show resolved
Hide resolved
server/zally-core/src/main/kotlin/org/zalando/zally/core/util/OpenApiUtil.kt
Show resolved
Hide resolved
validatePrimitiveSchemas(context) + validateAllProperties(context) | ||
|
||
private fun validateAllProperties(context: Context): List<Violation> = context.api.getAllProperties() | ||
.filter { it.value.type == "string" } |
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.
Didn't we need to check independent of property type for value definitions? Currently, it looks as if they are just not checked. However, I must confess, I have no idea how numbers 1
, 2
, and true
, false
would behave in this context.
👍 |
👍 |
boolean
enums are validatedextensibleEnum
extension returnAny
instead ofString
Related to #1221 and #1183