graphql-platform
graphql-platform copied to clipboard
Error on generating code for non nullable ICollection<Guid>
Describe the bug
If you have a DTO (maybe record) with a non nullable property ICollection<Guid> MyValues
than the generated schema.graphql looks great:
input MyDtoInput { myValues: [UUID!]! }
But the code generator for StrawberryShake throws an error on generating process:
Non-Nullable-Feld "_value_myValues" muss beim Beenden des Konstruktors einen Wert ungleich NULL enthalten. Erwägen Sie eine Deklaration von "Feld" als Nullable.
To get the process working the only possibility is to mark ICollection<Guid>? MyValues
as nullable.
Steps to reproduce
- Create DTO
public record MyDto( ICollection<Guid> MyValues);
- Create DTO
public record MyInput( MyDto MyValue)
- Update schema with
dotnet graphql update
- Create mutation
mutation SendMyInput( $dto:MyInput!){ sendMyInput( input: $dto ) }
- The code generator throws the error
Relevant log output
Non-Nullable-Feld "_value_myValues" muss beim Beenden des Konstruktors einen Wert ungleich NULL enthalten. Erwägen Sie eine Deklaration von "Feld" als Nullable.
Product
Hot Chocolate, Strawberry Shake
Version
12.6.0
@mwilde can you share query and schema?
@PascalSenn here is my schema and the mutation:
schema { mutation: Mutation }
type Mutation { setMyValue(input: SetMyValueInput!): SetMyValuePayload! }
type SetMyValuePayload { errors: [UserError!]! }
scalar UUID
type UserError { message: String! }
input SetMyValueInput { myValue: MyDtoInput! }
input MyDtoInput { myIds: [UUID!]! }
mutation SetMyValue( $dto:SetMyValueInput!){ setMyValue( input: $dto ){ errors { message } } }
@PascalSenn the same error occurs if you have a collection of type Enum.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@PascalSenn what is the status here?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@PascalSenn what is the status here?
I'm running into the same issue on version 12.12.1, is there any update @PascalSenn @tobias-tengler ?