Netflix / dgs-framework

GraphQL for Java with Spring Boot made easy.
https://netflix.github.io/dgs
Apache License 2.0
3.03k stars 286 forks source link

InputMapDefinesTooManyFieldsException: Cancel Field Validation #1852

Closed shijie-world closed 3 months ago

shijie-world commented 3 months ago

内容: plaintext Hello,

I'm currently working with GraphQL and encountered an issue with the InputMapDefinesTooManyFieldsException. This exception occurs when an undefined field is included in the input variable of a GraphQL mutation.

Here's an instance of the problem:

If our input type is defined as:


input BookInput {
  title: String
  author: String
}
And we includes an undefined field like this:
graphql
mutation {
  createBook(input: { title: "My Book", author: "Me", publicationDate: "2022" }) {
    id
  }
}
The InputMapDefinesTooManyFieldsException is thrown as the publicationDate field is not defined for BookInput.
I understand this is designed to help catch errors and avoid issues. However, due to my specific needs, I would like to know if there is a way to cancel, or bypass, this field validation functionality?
I've tried looking through the available configuration settings, documentation, and source code, but I couldn't find anything related to this feature.
Any guidance or suggestions on this would be greatly appreciated.
Thank you.
srinivasankavitha commented 3 months ago

This validation is actually done by graphql-java and not the DGS framework. Unfortunately, I am not aware of a way to bypass this check. I'm going to close this issue since this is not something we can address in the dgs framework.