ChilliCream / ChilliCream/graphql-platform

Error on generating code for non nullable ICollection<Guid>

Open
#4,739 7 comments 3 reactions 1 assignee View on GitHub

@PascalSenn is already working on this.

Since Feb 8, 2022.

🌶️ strawberry shake
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

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
  1. Create DTO public record MyDto( ICollection<Guid> MyValues);
  2. Create DTO public record MyInput( MyDto MyValue)
  3. Update schema with dotnet graphql update
  4. Create mutation mutation SendMyInput( $dto:MyInput!){ sendMyInput( input: $dto ) }
  5. 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.