-
Notifications
You must be signed in to change notification settings - Fork 83
Specify and add TCK test cases for @Digits constraint processing
#733
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -599,7 +599,7 @@ In some cases, additional schema restrictions can be inferred from Jakarta Bean | |
|
|
||
| If an implementation includes support for the Jakarta Bean Validation specification, then it must also process Jakarta Bean Validation annotations when creating OpenAPI schemas. Such implementations must add the properties listed in the table below to the schema model when: | ||
|
|
||
| * the annotation is applied to to an element for which a schema is generated and | ||
| * the annotation is applied to an element for which a schema is generated and | ||
| * the annotation and generated schema type are listed together in the table below and | ||
| * the annotation has a `group` attribute which is empty or includes `jakarta.validation.groups.Default` and | ||
| * the user has not set any of the relevant property values using other annotations and | ||
|
|
@@ -611,19 +611,18 @@ If an implementation includes support for the Jakarta Bean Validation specificat | |
| | `@NotEmpty` | `array` | `minItems = 1` | ||
| | `@NotEmpty` | `object` | `minProperties = 1` | ||
| | `@NotBlank` | `string` | `pattern = \S` | ||
| | `@Size(min = a, max = b)` | `string` | ||
| | `minLength = a + | ||
| | `@Size(min = a, max = b)` | `string` | `minLength = a + | ||
| maxLenth = b` | ||
| | `@Size(min = a, max = b)` | `array` | ||
| | `minItems = a + | ||
| | `@Size(min = a, max = b)` | `array` | `minItems = a + | ||
| maxItems = b` | ||
| | `@Size(min = a, max = b)` | `object` | ||
| | `minProperties = a + | ||
| | `@Size(min = a, max = b)` | `object` | `minProperties = a + | ||
| maxProperties = b` | ||
| | `@DecimalMax(value = a)` | `number` or `integer` | `maximum = a` | ||
| | `@DecimalMax(value = a, inclusive = false)` | `number` or `integer` | `exclusiveMaximum = a` | ||
| | `@DecimalMin(value = a)` | `number` or `integer` | `minimum = a` | ||
| | `@DecimalMin(value = a, inclusive = false)` | `number` or `integer` | `exclusiveMinimum = a` | ||
| | `@Digits(integer = <any>, fraction = f)` | `number` or `integer` | `multipleOf` equal to `1` for integer types or 10^-f for non-integer types | ||
| | `@Digits(integer = i, fraction = f)` | `string` | `pattern` matching any string value that satisfies the constraint | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Azquelt did we discuss having the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm happy to have both. The only reason we don't have
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I need to review the BV spec to make sure it's aligned there. I can imagine various gaps in how BV implementations validate cases like |
||
| | `@Max(a)` | `number` or `integer` | `maximum = a` | ||
| | `@Min(a)` | `number` or `integer` | `minimum = a` | ||
| | `@Negative` | `number` or `integer` | `exclusiveMaximum = 0` | ||
|
|
||
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 don't think we need to generate
multipleOf: 1if the schema type isinteger, since that's already implied.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.
Maybe a better way to specify this would be in terms of
fractionrather than in terms of the schema type. Whenfraction< 1, we expectmultipleOf = 1, otherwise it will be10^-f.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.
Well possibly, but consider this field:
We'd expect this schema:
{ "type": "integer", "multipleOf": 1 }Here the
multipleOf: 1is redundant since the schema already requires an integer. I don't think we should require this.This might mean that in the TCK we have to check for both cases: either the schema type is
integer, ormultipleOf: 1is present.