Conversation
|
Is there anything holding this up? This issue really creates a lot of unnecessary work for TypeScript users. |
|
idk, I'm ready for getting review! |
I believe this behavior should be config-based. Also, this can already be achieved today using a schema hook, so maybe we should provides a builtin hook for this. @giautm, your thoughts? |
Nullable to Non-nullable is a safe change, and should not consider as breaking changes. It just a bit annoying when update the generated code. The important thing we need check that is no cases entgql will return null for some nodes. The original implement was from Facebook respect, but when the spec go out community and grow, it doesn't correct anymore. So, I prefer to go with new Relay spec. |
ent/ent#3998
What's changed
Generates
nodefield in connection edge types as non-null types instead of nullable types.Background
According to the spec,
nodefield can be non-null.On the other hand,
edgesfield in connection types are defined as just a list type that wraps an edge type, which means[Edge]but not[Edge]!.So this PR only changes
nodefield and keepsedgesfield as it is.Concerns
My concern is whether we should consider this a breaking change.
GraphQL API clients can accept the transition from nullable to non-null fields without any change or breaking. How about servers? I'm not sure this change would break server implementations using ent.
If so, we can introduce this change as an option.