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 wrong validation on input field with default value #122

Merged
merged 1 commit into from Oct 22, 2020
Merged

Fix wrong validation on input field with default value #122

merged 1 commit into from Oct 22, 2020

Conversation

ghost
Copy link

@ghost ghost commented Mar 9, 2020

Avoid must be defined error on an input field having a default value defined in the schema:

type Query {
    structArg(i: InputType!): Boolean!
}
input InputType {
    name: String!
    defaultName: String! = "defaultFoo"
}

With variables:

{
  "var": {
     "name": "foo"
  }
}

Before:
Error received: input: variable.defaultName must be defined

After:
No more errors received, this is the expected behavior because a default value is defined in the schema.

@coveralls
Copy link

coveralls commented Mar 9, 2020

Coverage Status

Coverage increased (+0.007%) to 92.151% when pulling 52681f0 on vincenteasy:121/fix-wrong-validation-on-input-with-default-value into d7ac1ee on vektah:master.

@vektah
Copy link
Owner

vektah commented Mar 9, 2020

Thanks for the PR, it needs a test and a PR description before I can merge it.

@ghost
Copy link
Author

ghost commented Mar 17, 2020

@vektah

Thanks for the PR, it needs a test and a PR description before I can merge it.

Hi, Thanks for your review.

I've updated the description but I don't have any real test to add: I've just added a field with default value in the InputType defined in vars.graphql.

Before the patch, there was an error, and no more errors afterwards.

Which test can I add in addition?

@ghost
Copy link
Author

ghost commented Apr 17, 2020

Hi @vektah,

Hope you are well. Could you please review this PR?

Thanks

@lwc lwc merged commit df51733 into vektah:master Oct 22, 2020
@skaji
Copy link

skaji commented Nov 9, 2020

@lwc Could you create a new git tag (maybe v2.2.0?),
so that we can easily import this fix into our projects with go module?

@skaji
Copy link

skaji commented Dec 24, 2020

@lwc @vektah Sorry for bothering you again,
but could you create a new git tag?

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.

4 participants