Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

feat: make enum for numbers pass #646

wants to merge 2 commits into from

Conversation

bfabio
Copy link
Member

@bfabio bfabio commented Oct 4, 2022

Make enum for number pass even when there's no minimum and maximum.

Also, allow enum only if minimum and maximum are not set.

Make `enum` for number pass even when there's no `minimum` and
`maximum`.

Also, allow `enum` only if `minimum` and `maximum` are not set.
@vercel
Copy link

vercel bot commented Oct 4, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
api-oas-checker ❌ Failed (Inspect) Oct 4, 2022 at 2:27PM (UTC)

@bfabio
Copy link
Member Author

bfabio commented Oct 4, 2022

Some tests fail, but If this is good we can fix those and we can also do something similar to strings types.

Copy link
Collaborator

@ioggstream ioggstream left a 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]
Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Collaborator

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants