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

Input object is not validated when given entirely as a variable #1074

Closed
p-smith opened this issue Sep 12, 2019 · 2 comments
Closed

Input object is not validated when given entirely as a variable #1074

p-smith opened this issue Sep 12, 2019 · 2 comments
Assignees
Milestone

Comments

@p-smith
Copy link

p-smith commented Sep 12, 2019

Describe the bug
Input objects are not validated in queries when a variable is used to hold the entire input object.

To Reproduce
Consider the following schema:

input MyInput {
    someField: String
}

type Query {
    x(arg: MyInput): String
}

The following query will fail correctly with "The specified input object field clearlyNonsense does not exist.":

query MyQuery($value: String) {
    x(arg: { clearlyNonsense: $value })
}

variables =
{
    "value": "someString"
}

In the next query, the variable now holds an object. Despite being semantically identical to the first query, the query will not cause a validation error, and it is is executed fully:

query MyQuery($arg: MyInput) {
    x(arg: $arg)
}

variables =
{
    "arg": {
        "clearlyNonsense": "someString"
    }
}

Expected behavior
The second query should also fail with the same validation error.

Versions:

  • HotChocolate 10.0.1
@michaelstaib michaelstaib self-assigned this Sep 12, 2019
@michaelstaib michaelstaib added Hot Chocolate Core 🔍 investigate Indicates that an issue or pull request needs more information. labels Sep 12, 2019
@michaelstaib michaelstaib modified the milestones: 10.1.0, 10.2.0 Sep 12, 2019
@michaelstaib michaelstaib added bug and removed 🔍 investigate Indicates that an issue or pull request needs more information. labels Oct 28, 2019
@michaelstaib
Copy link
Member

#1170

@michaelstaib
Copy link
Member

This one is now fixed and will be included in the next 10.2.0 preview.

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