Skip to content

Conversation

@seantleonard
Copy link
Contributor

Why make this change?

What is this change?

  • Updates the version number of HotChocolate to 12.15.1 to include the fix Michael graciously added on Nov 1, 2022 to accommodate this ask. InvalidFormatException when a field is overflowed ChilliCream/graphql-platform#4378
  • The fix applies to queries and mutations such that type overflows still result in a Hot Chocolate error but HTTP response error code is 400.
  • Error message is: "The specified argument value does not match the argument type"

How was this tested?

  • Manual test because any unit tests would be testing the dependency's code (HotChocolate). Unit tests would be appropriate for that project.

Sample Request/Response

  • Query Request
query {
    book_by_pk(id: 999999999999) {
        id,
        title  
    }
}
  • Response (HTTP 400 bad request)
{
    "errors": [
        {
            "message": "The specified argument value does not match the argument type.",
            "locations": [
                {
                    "line": 2,
                    "column": 20
                }
            ],
            "path": [
                "book_by_pk"
            ],
            "extensions": {
                "argument": "id",
                "argumentValue": "999999999999",
                "locationType": "Int!",
                "specifiedBy": "http://spec.graphql.org/October2021/#sec-Values-of-Correct-Type"
            }
        }
    ]
}
  • Mutation
mutation {
    updatebook(
        id: 999999999999999
        item: {
            title: "You've finally done it!",
            publisher_id: 2345
        }
    )
    {
        id,
        title
    }
}

-Response

{
    "errors": [
        {
            "message": "The specified argument value does not match the argument type.",
            "locations": [
                {
                    "line": 3,
                    "column": 13
                }
            ],
            "path": [
                "updatebook"
            ],
            "extensions": {
                "argument": "id",
                "argumentValue": "999999999999999",
                "locationType": "Int!",
                "specifiedBy": "http://spec.graphql.org/October2021/#sec-Values-of-Correct-Type"
            }
        }
    ]
}

@seantleonard seantleonard changed the title GraphQL HotChocolate Field Type Overflow now returns Http 400 Bad Request GraphQL HotChocolate Field Type Overflow correctly returns Http 400 Bad Request Nov 2, 2022
@seantleonard seantleonard added bug Something isn't working graphql labels Nov 2, 2022
Copy link
Collaborator

@Aniruddh25 Aniruddh25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for following up with the comment, finding a new issue and committing to fixing it! Such diligence improves our product quality :)

@seantleonard seantleonard enabled auto-merge (squash) November 4, 2022 18:20
@seantleonard seantleonard merged commit 3e15bb9 into main Nov 4, 2022
@seantleonard seantleonard deleted the dev/seleonar/fieldTypeOverflowHC branch November 4, 2022 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working graphql

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GraphQL HotChocolate Handles Field Type Overflow as HTTP 500 erroneously

4 participants