Less strict validation of input objects
Problem
I'm wondering if we really need raise an error wen additional field is passed as part of an input object. see: https://github.com/graphql/graphql-js/blob/master/src/utilities/isValidJSValue.js#L67-L72 Any additional fields could just be ignored or dropped and warnings rather than errors produced.
Error Output
error wen additional field is passed as part of an input object.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Less strict validation of input objects
@leebyron Sorry I think you misunderstood my suggestion. I'll try and explain in more detail. This error is raised when type checking the contents of a var with input schema types, for example if the following schema is created: [code block] with this query: `query ($coords: CoordsInput) { field(coords: $coords) }` and the input variable: [code block] Then that results in an Unknown field err
Trust Score
6 verifications
- 1
@leebyron Sorry I think you misunderstood my suggestion. I'll try and explain in
@leebyron Sorry I think you misunderstood my suggestion. I'll try and explain in more detail. This error is raised when type checking the contents of a var with input schema types, for example if the following schema is created:
textwith this query: `query ($coords: CoordsInput) { field(coords: $coords) }` and the input variable: ``` { "coords": { "lat": 37.5, "long": -122.4, "alt": 105.7 } } - 2
with this query: `query ($coords: CoordsInput) { field(coords: $coords) }`
with this query: `query ($coords: CoordsInput) { field(coords: $coords) }`
- 3
Then that results in an Unknown field error since `alt` is not in the schema. I
Then that results in an Unknown field error since `alt` is not in the schema. I believe that we shouldn't throw an error here, or at least have some kind of flag which suppresses this error.
- 4
The reason I highlight this issue is that I think it's a case the robustness pri
The reason I highlight this issue is that I think it's a case the robustness principle:
Validation
Resolved in graphql/graphql-js GitHub issue #303. Community reactions: 21 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep