-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
CRDGenerator: Add support for exclusiveMinimum/exclusiveMaximum #5868
Comments
@baloo42 I'll try to catch up with those linked issues in the next few days(I wanna dedicate to this the right amount of attention), feel free to ping me directly if I miss something or I'm not answering somewhere(I might just have missed the notification 🙂 ). |
No problem - take your time. This issue here has no priority for me. The intention was to get an overview of the missing features and how possible solutions could look like. Now we have a place where we can discuss solutions to this problem. |
TBD:
|
Reviewing this one and the only note is that I would use Feel free to go ahead and we can cover the details of an implementation, I think 🙂 |
Is your enhancement related to a problem? Please describe
At the moment the CRDGenerator does not support exclusiveMinimum/exclusiveMaximum (boolean):
https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/custom-resource-definition-v1/#JSONSchemaProps
exclusiveMaximum
5.1.2.1. Valid values
The value of "maximum" MUST be a JSON number. The value of "exclusiveMaximum" MUST be a boolean.
If "exclusiveMaximum" is present, "maximum" MUST also be present.
5.1.2.2. Conditions for successful validation
Successful validation depends on the presence and value of "exclusiveMaximum":
if "exclusiveMaximum" is not present, or has boolean value false, then the instance is valid if it is lower than, or equal to, the value of "maximum";
if "exclusiveMaximum" has boolean value true, the instance is valid if it is strictly lower than the value of "maximum".
5.1.2.3. Default value
"exclusiveMaximum", if absent, may be considered as being present with boolean value false.
exclusiveMinimum
5.1.3.1. Valid values
The value of "minimum" MUST be a JSON number. The value of "exclusiveMinimum" MUST be a boolean.
If "exclusiveMinimum" is present, "minimum" MUST also be present.
5.1.3.2. Conditions for successful validation
Successful validation depends on the presence and value of "exclusiveMinimum":
if "exclusiveMinimum" is not present, or has boolean value false, then the instance is valid if it is greater than, or equal to, the value of "minimum";
if "exclusiveMinimum" is present and has boolean value true, the instance is valid if it is strictly greater than the value of "minimum".
5.1.3.3. Default value
"exclusiveMinimum", if absent, may be considered as being present with boolean value false.
Describe the solution you'd like
The existing annotations
@Min
and@Max
allow to define the "inclusiveness":Note that this won't be a breaking change because the above defaults would result in
exclusiveMinimum
/exclusiveMaximum
=false
which can be omitted and which is the case at the moment.Describe alternatives you've considered
We could introduce instead or additionally a new annotation
@Schema
like in swagger-core, which allows to specifyexclusiveMinimum/exclusiveMaximum
directly.But in my opinion it's more important to tie it directly to the value.
Additional context
The text was updated successfully, but these errors were encountered: