-
Notifications
You must be signed in to change notification settings - Fork 646
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
@experimental -> @requiresOptIn #4175
Conversation
...o-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/helpers/KDoc.kt
Outdated
Show resolved
Hide resolved
@@ -519,16 +517,17 @@ interface Service { | |||
val sealedClassesForEnumsMatching: ListProperty<String> | |||
|
|||
/** | |||
* The annotation to use for experimental fields/inputFields/enumValues | |||
* The annotation to use for `@requiresOptIn` fields/inputFields/enumValues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is all still "cooking" :) but it would make sense to have a mapping (feature -> annotation) instead?
So for instance
type Foo {
field: String
betaField: String @requiresOptIn(feature: "beta")
alphaField: String @requiresOptIn(feature: "alpha")
}
could generate
data class Foo(
field: String,
@Beta
betaField: String,
@Alpha
alphaField: String,
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, good point. Ultimately, I think we'll want to do this with GraphQL configuration, not Gradle configuration:
extend directive @requiresOptIn @map(feature: "alpha", annotation: "com.example.Alpha")
@map(feature: "beta", annotation: "com.example.Beta")
or if we decide to go the "markers" road:
directive @alpha on FIELD @requiresOptIn
directive @beta on FIELD @requiresOptIn
extend directive @alpha @targetName(name: "com.example.Alpha")
extend directive @beta @targetName(name: "com.example.Beta")
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah doing this with GraphQL is nice! I guess it'll depend on which direction the RFC goes but both approaches look good to me :)
e5f3720
to
aac6d0d
Compare
✅ Deploy Preview for apollo-android-docs canceled.
|
… API being experimental
Rename
@experimental
to@requiresOptIn
Also:
@targetName