Open mwilde opened 2 years ago
@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.
@PascalSenn what is the status here?
@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 ?
Have this problem with 13.9.12 Error in English: "error CS8618: Non-nullable field '_value_ids' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable."
Workaround: Create a partial class with the same name and default constructor. Disable warning with #pragma
public partial class MyDtoInput
{
#pragma warning disable CS8618
public MyDtoInput() {}
#pragma warning restore CS8618
}
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
public record MyDto( ICollection<Guid> MyValues);
public record MyInput( MyDto MyValue)
dotnet graphql update
mutation SendMyInput( $dto:MyInput!){ sendMyInput( input: $dto ) }
Relevant log output
Product
Hot Chocolate, Strawberry Shake
Version
12.6.0