Is there an existing issue for this?
Product
Strawberry Shake
Describe the bug
In a recent project encountered "cannot convert from" error in the StrawberryShake generated code. I simplified the data structure which is handled with errors in the StrawberryShake generator.
There is a base type (ParentType), that is used in one mutation result (MutationResultVariantA) and the there is a extended type (ParentVariant), which is used in the second mutation result (MutationResultVariantB).
Additional data that is inside these types were stripped for simplicity.

The generated error:
cannot convert from 'ConsoleApp1.State.IParentTypeData' to 'ConsoleApp1.State.ParentVariantData'
Steps to reproduce
- mutations.graphql:
mutation mutationOneTest {
testMutation {
parent {
someValue
}
}
}
mutation mutationOne {
testMutation {
... on MutationResultVariantB {
parent {
... on ParentVariant {
someValue
}
}
}
}
}
- schema.graphql:
schema {
query: Query
mutation: Mutation
}
type Query {
testQuery(): MutationResult!
}
type Mutation {
testMutation(): MutationResult!
}
interface MutationResult {
parent: ParentType!
}
interface ParentType {
someValue: Int!
}
type MutationResultVariantA implements MutationResult {
parent: ParentType!
}
type MutationResultVariantB implements MutationResult {
parent: ParentVariant!
}
type ParentVariant implements ParentType {
someValue: Int!
}
- .graphqlrc,json
{
"schema": "schema.graphql",
"documents": "**/*.graphql",
"extensions": {
"strawberryShake": {
"name": "GraphQLClient",
"dependencyInjection": true,
"strictSchemaValidation": true,
"hashAlgorithm": "md5",
"useSingleFile": true,
"requestStrategy": "Default",
"outputDirectoryName": "Generated",
"noStore": false,
"emitGeneratedCode": true,
"razorComponents": false,
"records": {
"inputs": false,
"entities": false
},
"transportProfiles": [
{
"default": "Http",
"subscription": "WebSocket"
}
]
}
}
}
- Run the generator
- There is a repo with the bug present: https://github.com/maris-jurgenbergs/SBSGQLBug
Relevant log output
No response
Additional Context?
No response
Version
12.18.0
Is there an existing issue for this?
Product
Strawberry Shake
Describe the bug
In a recent project encountered "cannot convert from" error in the StrawberryShake generated code. I simplified the data structure which is handled with errors in the StrawberryShake generator.
There is a base type (ParentType), that is used in one mutation result (MutationResultVariantA) and the there is a extended type (ParentVariant), which is used in the second mutation result (MutationResultVariantB).

Additional data that is inside these types were stripped for simplicity.
The generated error:
cannot convert from 'ConsoleApp1.State.IParentTypeData' to 'ConsoleApp1.State.ParentVariantData'Steps to reproduce
Relevant log output
No response
Additional Context?
No response
Version
12.18.0