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

"is not one of" error should happen only after checking type #948

Closed
ssbarnea opened this issue May 17, 2022 · 3 comments
Closed

"is not one of" error should happen only after checking type #948

ssbarnea opened this issue May 17, 2022 · 3 comments

Comments

@ssbarnea
Copy link
Contributor

As we are using enums to validate values that can have only a specific set of values, we identified a series of very confusing validation error messages.

 8 is not one of ['6.1', '7.1', '7.2', 'all'] 

As you can see the 8 does not have quotes, because in that case the user introduced int/float instead of string. Still, schema does not do anything about this and just displays the message.

What makes it even more confusing is that you do not see '8', being listed among possible accepted values. That is because we make use of a big oneOf which checks among various combinations of platform name and platform-versions. Basically validator fails to find any combination as working and displays the first failure.

I am not sure how to fix it but I know that we do have the type string mentioned for all of them and it I suspect that the first thing we should do is to ensure we raise an error about type before looking at the enum. If type is not the expected one, it makes to sense to complain about the list of allowed values?

@konstruktoid
Copy link

The code triggering the issue:

    - name: EL
      versions:
        - 8

@Julian
Copy link
Member

Julian commented May 17, 2022

There's #728 which may be this issue, have a look. Are you using best_match already?

@Julian
Copy link
Member

Julian commented May 24, 2022

Feel free to follow up if the above doesn't cover your issue.

@Julian Julian closed this as completed May 24, 2022
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

No branches or pull requests

3 participants