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

Validation not done on values which are zero #187

Open
vancejc-mt opened this issue Jul 19, 2023 · 1 comment
Open

Validation not done on values which are zero #187

vancejc-mt opened this issue Jul 19, 2023 · 1 comment

Comments

@vancejc-mt
Copy link

vancejc-mt commented Jul 19, 2023

Hello,

Running apollo-server 3.8.2 using this package, l have the following in the schema:

extend type Query {
    searchForFonts(
        pageSize: Int @constraint(min: 1, max: 25)
    ): FontSearchResponse!
}

If I send a pageSize value of -1 I correctly get an error of it being below the minimum. However, if I pass a pageSize of 0, it doesn't flag an error at all.

I suspect possibly this is an issue with apollo-server (where he won't call parseValue at all because of a stray if(value) check) but wanted to check and see if anyone had run into this before?

Thanks

@velias
Copy link
Contributor

velias commented Jul 20, 2023

Have you tried to make pageSize mandatory, or maybe set the default value for it as a workaround? This definitely looks like it treats 0 as a not set value at all 😕

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

2 participants