conventions icon indicating copy to clipboard operation
conventions copied to clipboard

Question regarding auto-generating Graph schema & types in FE

Open Tim-Maes opened this issue 2 years ago • 1 comments

We're using a graph-api-generator library to generate all types in the frontend. Queries always return a result -never null- and we have Angular 13 with strict typing.

When we generate the types, the outputTypes are generated as Type | null | undefined or Type | any.

I wonder if there is a way in backend to indicate non-null results (as in NonNull<T> for input) ? If there is, how? :)

Thanks

Tim-Maes avatar May 16 '22 12:05 Tim-Maes

Do you mean something like this?

public NonNull<string> NonNullablePrimitiveField(NonNull<string> nonNullablePrimitiveArg) => /* ... */;

from test/GraphQL.Conventions.Tests/Adapters/ArgumentResolutionTests.cs :-)

tlil avatar May 17 '22 05:05 tlil