-
Notifications
You must be signed in to change notification settings - Fork 749
Closed as duplicate
Labels
codegenIssues related to or arising from code generationIssues related to or arising from code generationfeatureNew addition or enhancement to existing solutionsNew addition or enhancement to existing solutions
Description
Use case
I would like to have a similar feature set to Apollo Kotlin which is adopting semanticNonNull in order to more accurately describe the domain of null because nothing, null because of error, and null because of bubbled error. I would also like the solution to provide ergonomic access to field errors for existing nullable types
Describe the solution you'd like
- Improved accessors. One or a choice of the following (the choice could be configured through codegen or directive parameters):
- for a semantically non-null field:
var field: String { get throws(GraphQLError) }orvar field: Result<String, GraphQLError>or@SemanticNonNull var field: String?where@SemanticNonNullis a property wrapper providing a projected value$fieldthat is of typeGraphQLError?
- for a semantically nullable field:
- the above accessors, except with optionals where appropriate
- for a semantically non-null field:
- A way to opt-in to this behavior incrementally via schema directives. For consistency's sake, the Kotlin implementation seems like a sensible starting point: https://www.apollographql.com/docs/kotlin/advanced/nullability#introduction.
Given the spec is still in flux, dropping the server directive and simply offering something like _semanticNonNullField might be a good way to scare off uninitiated users who aren't following the workgroup discussions.
I understand Swift 6 is a big priority right now but at least having this on the roadmap would be a good start, I think!
Metadata
Metadata
Assignees
Labels
codegenIssues related to or arising from code generationIssues related to or arising from code generationfeatureNew addition or enhancement to existing solutionsNew addition or enhancement to existing solutions