webiny-js icon indicating copy to clipboard operation
webiny-js copied to clipboard

Make list queries return non-nullable data

Open StampixSMO opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe.

When integrating the exposed GraphQL API in typed languages (e.g. TypeScript), you have to write boilerplate code to check for nullability of the data field inside ListX queries. Inherently though, I believe the returned values can never be null. image

It also cause for the following ugly-looking typings in for example TS: image

Describe the solution you'd like.

Ideally, Webiny can return a non-nullable data field for the returned array + non-nullable actual type values inside the array. In the example above, that would be [Product!]! instead of [Product].

Describe alternatives you've considered.

I've thought about wrapping the schema and adjusting the typings, but that requires a gateway in front of Webiny.

StampixSMO avatar Jan 20 '22 14:01 StampixSMO

This issue is stale because it was opened 120 days with no activity. Remove the "stale-issue" label or leave a comment to revive the issue. Otherwise, it will be closed in 7 days.

webiny-bot avatar May 21 '22 07:05 webiny-bot