-
Notifications
You must be signed in to change notification settings - Fork 13
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
Write up concerns regarding the try/catch method proposed for CCN #2
Comments
Relates to this discussion: graphql/graphql-wg#1009 (reply in thread) |
Ignoring the orthagonal concerns of where errors are raised in the response and other such things, I think we're broadly discussing that there are three main options for Client Controlled Nullability:
Up front, I want to state (for the sake of transparency, and to help you carefully analyze the bias in my statements) that my preference continues to be option (1). In my opinion option 1 is both the most straightforward to understand (there's nothing extra to learn), straightforward to implement (all we need is the ability to substitute the type in the existing algorithm), and has the fewest unintended consequences. Example schemaThis schema is used for all examples: type Query {
forum(id: ID!): Forum
}
type Forum {
id: ID!
posts(first: Int): [Post]
}
type Post {
id: ID!
topic: String
author: User
}
type User {
id: ID!
name: String
avatarUrl: String!
} Example 1Consider this query: query ForumMainPage ($id: ID!) {
forum(id: $id) {
posts(first: 10) {
...Post
}
}
}
fragment Post on Post {
id
topic
author {
...Author
}
}
fragment Author on User {
id
avatarUrl
name!
} Let's imagine that someone is writing the Author component to render the name and avatar of the user who posted a comment or post or similar. They know that The person responsible for rendering the Post doesn't know or care what's inside the Author component, so they just splat that out without digging too deeply. They may well have written the Post to compose the Author fragment before the A month passes, and the business realises that they need a way for users to delete their accounts. They don't want to delete the posts, but they make it so that if the author is null then that represents a deleted user. (Had they thought ahead they might have used Another month passes, and the business changes the sign up process for users. A User's Consider a mobile client released before these two API changes, dealing with complexities in the latest data. a. When rendering the list with a
|
Benjie expressed concerns about the try/catch interpretation of CCN and would prefer to just use the mechanisms that GraphQL already has. He intends to write up some examples to demonstrate the issues that he foresees.
Note: Action Item issues are reviewed and closed during Working Group
meetings.
The text was updated successfully, but these errors were encountered: