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

Bug: Any non-string value in GraphError.Path will cause the GraphService to throw a ShopifyJsonParseException #1152

Open
nozzlegear opened this issue Feb 2, 2025 · 0 comments · May be fixed by #1154
Assignees
Labels
bug graphql serialization Anything affecting json or http content serialization.
Milestone

Comments

@nozzlegear
Copy link
Owner

The default System.Text.Json deserializer does not like to coerce integers to strings like Newtonsoft.Json does. It prefers to throw an exception instead.

Example problematic json:

{"errors":[{"message":"you must provide one of first or last","locations":[{"line":23,"column":13}],"path":["orders","nodes",0,"lineItems"]}],"data":null,"extensions":{"cost":{"requestedQueryCost":40,"actualQueryCost":16,"throttleStatus":{"maximumAvailable":2000.0,"currentlyAvailable":1984,"restoreRate":100.0}}}}

The integer 0 in "path": ["orders", "nodes", 0, "lineItems"] will make System.Text.Json throw a JsonException, which ShopifySharp catches and wraps up in a ShopifyJsonParseException.

Related to #1149, the SystemJsonDeserializer needs to ease up on its strict parsing rules for these properties that Shopify doesn't document.

@nozzlegear nozzlegear added bug graphql serialization Anything affecting json or http content serialization. labels Feb 2, 2025
@nozzlegear nozzlegear self-assigned this Feb 2, 2025
@nozzlegear nozzlegear added this to the 6.22.2 milestone Feb 2, 2025
@nozzlegear nozzlegear linked a pull request Feb 5, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug graphql serialization Anything affecting json or http content serialization.
Projects
Development

Successfully merging a pull request may close this issue.

1 participant