ChilliCream / graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
https://chillicream.com
MIT License
5.28k stars 748 forks source link

StrawberryShake: Mutation containing a union with nested data fails to generate code #3547

Closed ChrisMH closed 3 years ago

ChrisMH commented 3 years ago

UserSetting.zip

preview.27

I have a mutation that returns a union where one part has a nested data structure:

mutation StoreUserSettingFor($userId: Int!, $customerId: Int!, $input: StoreUserSettingForInput!) {
    storeUserSettingFor(userId: $userId, customerId: $customerId, input: $input) {
        ... on UserSettingSuccess {id}
        ... on UserSettingError {errors {code message}}
    }
}

When building the above, code generation returns: CSC : error SS0006: The given key 'StrawberryShake.RuntimeType' was not present in the dictionary. [C:\Users\chogan\DevO\ovc-source\WebService\GraphTest\GraphTest.csproj]

I have tried removing the other arm of the union with the same error message:

mutation StoreUserSettingFor($userId: Int!, $customerId: Int!, $input: StoreUserSettingForInput!) {
    storeUserSettingFor(userId: $userId, customerId: $customerId, input: $input) {
        ... on UserSettingError {errors {code message}}
    }
}

I don't know for sure that it's the nested data, but UserSettingSuccess, which is flat, works, and the other doesn't.

PascalSenn commented 3 years ago

@ChrisMH can you share your schema too? I could not reproduce this issue

ChrisMH commented 3 years ago

@PascalSenn Attached