-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(nullability) Allow @catch directive to apply all usages of interface field in an operation #47
Comments
This should be addressed with #48. To always catch to RESULT on extend interface RowEntitiesEdge @catchField(name: "node") It'll be available in the 4.0.0-beta.5-SNAPSHOT versions once CI terminates |
@martinbonnin , thank you! I'm getting around to trying this now :) We tend to use unions as our return types to give us flexibility to change it in the future, which means that we need to use inline fragment spreads even when we know that there's only one possible object type this union could have. This leads to us having to deal with nullable inline fragment spreads. |
Hi 👋 Apologies for the late response. union Node = Product | Review
extend union RowEntitiesEdge @catchField(name: /*there is no field to put here*/) if an object or interface has a node type. You can mark it as type Query {
node: Node
}
# This works
extend type Query @catchField(name: "node")
I think this is typically what you want? Same as |
Thank you for explaining, @martinbonnin ! I think that makes sense. |
Can we consider extending the nullability spec to allow applying the
@catch
to an interface type, and have it apply to all fields in that operation which implement that interface? Maybe using schema extensions if that's a better fit.Here's an example of what our schema looks like:
And then in our operations, we use spreads to
Currently, if I want to
@catch
something at an entity level, I would need to end up adding the@catch
at every single usage of thePageRow
, which can be over 20-25 rows for a given operation.As a result, I think we could add a
@catch
for, say,RowEntitiesEdge
, and allow it to "apply" to all the concrete field usages, I think it would allow us to use that directive in a more straightforward and clean way.The text was updated successfully, but these errors were encountered: