graphql-java-codegen icon indicating copy to clipboard operation
graphql-java-codegen copied to clipboard

Exception de-serializing errors sent by AWS AppSync

Open vladdex opened this issue 1 year ago • 2 comments

Issue Description

Some errors sent by an application built on AWS AppSync contain and extra field called "data" which does exist in the GraphQLError class. Furthermore if I ignore unknown properties the GraphQLErrorType is missing error types provided by AppSync ex Lambda:Unhandled. Is there any way to override these when generating the models ?

Steps to Reproduce

To reproduce try to de-serialize the following json into a GraphQLResult

{
    "data": null,
    "errors": [
        {
            "path": [
                "addProject"
            ],
            "data": null,
            "errorType": "Lambda:Unhandled",
            "errorInfo": null,
            "locations": [
                {
                    "line": 1,
                    "column": 23,
                    "sourceName": null
                }
            ],
            "message": "There is already a Project with name AutoProj-Duplicate1679598192925 in the system"
        }
    ]
}

Expected Result

Json should de-serialize correctly

Actual Result

De-serialization fails because "data" is an urecognised field and Lambda:Unhandled is an unrecognised error type

Your Environment and Setup

  • graphql-java-codegen version: 5.6.0
  • Build tool: Gradle

vladdex avatar Mar 23 '23 20:03 vladdex