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

GraphService error and extension property deserialization fixes #1154

Merged
merged 12 commits into from
Feb 28, 2025

Conversation

nozzlegear
Copy link
Owner

@nozzlegear nozzlegear commented Feb 5, 2025

This is a draft pull request that I'm working on containing fixes for various bugs pertaining to the ShopifyJsonParseExceptions thrown by the GraphService when the errors or extensions properties don't have the structure the service expects them to have.

TODO:

…ngListConverter and PrimitiveStringConverterFactory
…lean value

The FalseToNullConverter had a bug that would cause it to write any non-null, non-false value as `true`. In practice this should not have occurred since this converter was only meant to be applied to boolean properties, but CanConvert does allow it to be applied to strings as well.
…ects as a dictionary

Fixes an issue where nested objects read by the converter would be returned as a SystemJsonElement.

Related to #1149.
…rs to dicts

Add a System.Text.Json converter which is responsible for mapping the
different json structures we've seen on the `GraphErrorExtensions.Value`
property. So far the property can have the following two structures:

1. `{"Value":{"foo":"bar","baz":"bat"}}`
2. `{"Value":"bar"}`

For backwards compatibility, the GraphErrorExtensionsValueConverter
takes structure #2 and maps it to structure #1, maintaining the
`IReadOnlyDictionary<string, object?>` type. An arbitrary key of
`$value` is assigned in this case.

Just speculation, but I believe that #2 happens when there is a problem
with the parameter passed to a GraphQL query/mutation; the string
`"bar"` here is the problematic parameter value. On the other hand, #1
represents a problem with a query or mutation structure, e.g. the data
being queried.

Fixes #1149
@nozzlegear nozzlegear marked this pull request as ready for review February 28, 2025 07:43
@nozzlegear nozzlegear merged commit 1a60489 into master Feb 28, 2025
@nozzlegear nozzlegear deleted the fix-1152 branch February 28, 2025 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment