-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat: make enum for numbers pass #646
base: master
Are you sure you want to change the base?
Conversation
Make `enum` for number pass even when there's no `minimum` and `maximum`. Also, allow `enum` only if `minimum` and `maximum` are not set.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Some tests fail, but If this is good we can fix those and we can also do something similar to strings types. |
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.
- max/min + enum is OK to me
@@ -9,10 +9,18 @@ components: | |||
ko_Number_nomax: | |||
type: number | |||
minimum: 1 | |||
ko_EnumAndMinMax: | |||
type: number | |||
enum: [3] |
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.
This can be syntactically valid to me. I could for example validate boundaries before checking the enumeration.
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.
Makes sense.
We need to check if enum values are inside the min-max range though, I don't think it's possible with Spectral without a custom function.
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.
@bfabio no need to push it that far for now. Probably spectral will do it for us in background today or tomorrow.
Co-authored-by: Roberto Polli <robipolli@gmail.com>
Make
enum
for number pass even when there's nominimum
andmaximum
.Also, allow
enum
only ifminimum
andmaximum
are not set.