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

fix: GQL syntax strings are incorrectly validated as enums #1134

Merged
merged 3 commits into from
Nov 10, 2021
Merged

fix: GQL syntax strings are incorrectly validated as enums #1134

merged 3 commits into from
Nov 10, 2021

Conversation

frekw
Copy link
Collaborator

@frekw frekw commented Nov 10, 2021

This was a bad consequence as a result of #1064

Instead of doing it during validation, we now rewrite the variables to be enums (if they should be) before running the validation, which I think is a more correct approach to it.

Copy link
Owner

@ghostdogpr ghostdogpr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -6,6 +6,7 @@ import caliban.Value.EnumValue
import zio._
import zio.test._
import zio.test.environment.TestEnvironment
import Assertion._
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: I usually use full paths, so zio.test.Assertion._

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -155,6 +156,27 @@ object FieldArgsSpec extends DefaultRunnableSpec {
)
)
)
},
testM("it doesn't allow strings as enums in GQL syntax") {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed GraphQL string literals must not be accepted as an enum input and instead raise a query error. 👍

@ghostdogpr ghostdogpr merged commit ee15775 into ghostdogpr:master Nov 10, 2021
@frekw frekw deleted the fix/enum-strings branch November 10, 2021 20:41
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