I've been implementing some requests with the fluent GraphQL query builder and I successfully created a file on my store but I'm getting this exception when I deserialize the response:
Inner Exception 1:
ShopifyUnspecifiedTypeDiscriminatorException: Deserialization of 'ShopifySharp.GraphQL.FileCreatePayload' failed. The JSON payload for the GraphQL union or interface type 'ShopifySharp.GraphQL.IFile' at JSON path 'data' does not include the required type discriminator ('__typename'). Add '__typename' to your query selection for this type to enable polymorphic deserialization.
Inner Exception 2:
NotSupportedException: The JSON payload for polymorphic interface or abstract type 'ShopifySharp.GraphQL.IFile' must specify a type discriminator. Path: $.files[0] | LineNumber: 0 | BytePositionInLine: 16.
I found this issue, but the solution is for the previous implementation.
Here is my code:
var files = new List<FileCreateInput>()
{ new FileCreateInput() {
contentType = FileContentType.IMAGE,
originalSource = url,
filename = url.Split('/').Last()
}};
var builder = new FileCreateOperationQueryBuilder().Files(f => f.Id()).UserErrors(u => u.Message().Field()).SetArguments(p => p.Files(files));
var result = Provider.GraphService.PostAsync(GraphRequest.FromQueryBuilder(builder)).Result;
Is there a parameter missing?
I've been implementing some requests with the fluent GraphQL query builder and I successfully created a file on my store but I'm getting this exception when I deserialize the response:
Inner Exception 1:
ShopifyUnspecifiedTypeDiscriminatorException: Deserialization of 'ShopifySharp.GraphQL.FileCreatePayload' failed. The JSON payload for the GraphQL union or interface type 'ShopifySharp.GraphQL.IFile' at JSON path 'data' does not include the required type discriminator ('__typename'). Add '__typename' to your query selection for this type to enable polymorphic deserialization.
Inner Exception 2:
NotSupportedException: The JSON payload for polymorphic interface or abstract type 'ShopifySharp.GraphQL.IFile' must specify a type discriminator. Path: $.files[0] | LineNumber: 0 | BytePositionInLine: 16.
I found this issue, but the solution is for the previous implementation.
Here is my code:
Is there a parameter missing?