-
Notifications
You must be signed in to change notification settings - Fork 93
Set multipleOf for numbers with @Digits, stop generating pattern
#2422
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
Signed-off-by: Michael Edgar <[email protected]>
|
@Azquelt please take a look if you have a chance and let me know if anything here appears to you that it may conflict with the spirit of microprofile/microprofile-open-api#717. |
Signed-off-by: Michael Edgar <[email protected]>
|
@Postremus FYI. Please take a look and give feedback if this looks amiss. |
|
Azquelt
left a comment
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.
Looks good, I don't see any conflicts with microprofile/microprofile-open-api#717
I've left a comment but my only other thoughts were additional things we could do:
- We could infer minimum and maximum values based on
Digits.integerif it's not otherwise constrained.- I'm a little uncertain on this since it's entirely possible the real constraint is tighter than
@Digitssuggests - although strictly speaking
@Digits(integer = 6)implies"maxExclusive": 100000, "minExclusive": -100000, having that constraint might be worse than having no constraint documented if the actual constraint were e.g.0 <= x < 65536
- I'm a little uncertain on this since it's entirely possible the real constraint is tighter than
- We could infer
"multipleOf": 1for integer types
core/src/main/java/io/smallrye/openapi/runtime/scanner/dataobject/BeanValidationScanner.java
Show resolved
Hide resolved
|
@MikeEdgar looks good to me. |
I considered this one too, but didn't do it here mainly for the reason you mentioned about being inaccurate. I suppose if
You mean when no |
Ah that's true, it would then be redundant. |
|
I've opened #2423 for the additional handling to set min/max constraints so we can think about that in the future and not block this fix/change for now. |



Remove incorrect mapping of number
@Digitstopatternschema constraint and replace withmultipleOfwhen not already set in the schema. UsesmultipleOf: 1for integers (i.e.Digits#fraction()<= 0) andmultipleOfbased onfractionvalue when > 0.Fixes #2384