-
Notifications
You must be signed in to change notification settings - Fork 660
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
Include deprecated arguments and directives in introspection #4702
Conversation
✅ Deploy Preview for apollo-android-docs canceled.
|
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.
🚀
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.
As hinted by @calvincestari (Thanks!), we'll need to make includeDeprecated
on args and inputFields optional as they're only supported in the draft version of the spec and some servers might not support it.
libraries/apollo-cli/src/main/kotlin/com/apollographql/apollo3/cli/DownloadSchemaCommand.kt
Outdated
Show resolved
Hide resolved
🐶 🥫 suggestion: could we recursively use apollo-kotlin to build a typesafe introspection query to be used by apollo-kotlin? Maybe have 2 versions of the schema, one for the current spec and one for the draft? |
…t spec. Also, allow schemas to redefine the built-in types.
I tried to use apollo-kotlin but couldn't use the 'draft spec' introspection types with it 😿. Instead I updated the built-ins so it will possible in the future after this is published in a version. Also removed the restriction preventing from overriding the introspection types in a project's schema, so if this happens again in the future we'll be able to make it work. Also, removed the flag and instead try the 'draft spec' query first, and fallback to the 'October2021 spec' query if it failed. |
...pollo-ast/src/main/kotlin/com/apollographql/apollo3/ast/introspection/IntrospectionSchema.kt
Outdated
Show resolved
Hide resolved
...ies/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrSchemaBuilder.kt
Show resolved
Hide resolved
|
This reverts commit 340fe6f. # Conflicts: # libraries/apollo-ast/api/apollo-ast.api
...o-ast/src/main/kotlin/com/apollographql/apollo3/ast/introspection/introspection_to_schema.kt
Show resolved
Hide resolved
@@ -1512,7 +1512,8 @@ | |||
}, | |||
"defaultValue": null | |||
} | |||
] | |||
], | |||
"isRepeatable": false |
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.
This is (yet another) question: I think we'll want to keep being able to read "old" json schemas. Without this, we're taking the risk of having codegen fail for a lot of users that are using current (or older) spec without "isRepeatable"
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.
Can you revert that part? I'd like to keep our test suite unchanged unless we make some behaviour change that we need to document either in the CHANGELOG or migration guide (but I don't think this is the case here?)
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.
👍 makes sense
import kotlin.Unit | ||
import kotlin.collections.List | ||
|
||
public class Introspection() : Query<Introspection.Data> { |
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.
Where are these files coming from?
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.
Woops added by mistake, good catch!
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.
The same way we need to support querying both versions from introspection, we'll need to be able to read both versions of Jsons. Maybe it's "just" a matter of setting default values for isRepeatable
and others potentially missing fields.
...pollo-ast/src/main/kotlin/com/apollographql/apollo3/ast/introspection/IntrospectionSchema.kt
Outdated
Show resolved
Hide resolved
libraries/apollo-gradle-plugin/testProjects/convertSchema/schemas/schema-legacy.json
Outdated
Show resolved
Hide resolved
libraries/apollo-gradle-plugin/testProjects/buildCache/src/main/graphql/starwars/schema.json
Outdated
Show resolved
Hide resolved
fun copy( | ||
queryType: QueryType = this.queryType, | ||
mutationType: MutationType? = this.mutationType, | ||
subscriptionType: SubscriptionType? = this.subscriptionType, | ||
types: List<Type> = this.types, | ||
) = copy( | ||
queryType = queryType, | ||
mutationType = mutationType, | ||
subscriptionType = subscriptionType, | ||
types = types, | ||
directives = emptyList(), | ||
) |
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'm guessing this is a binary compatibility method? If yes, the problem is that it shadows the default .copy
and gets resolved from normalize()
for an example.
Maybe make it hidden?
fun copy( | |
queryType: QueryType = this.queryType, | |
mutationType: MutationType? = this.mutationType, | |
subscriptionType: SubscriptionType? = this.subscriptionType, | |
types: List<Type> = this.types, | |
) = copy( | |
queryType = queryType, | |
mutationType = mutationType, | |
subscriptionType = subscriptionType, | |
types = types, | |
directives = emptyList(), | |
) | |
@Deprecated("For binary compatibility only.", level = DeprecationLevel.HIDDEN) | |
fun copy( | |
queryType: QueryType = this.queryType, | |
mutationType: MutationType? = this.mutationType, | |
subscriptionType: SubscriptionType? = this.subscriptionType, | |
types: List<Type> = this.types, | |
) = copy( | |
queryType = queryType, | |
mutationType = mutationType, | |
subscriptionType = subscriptionType, | |
types = types, | |
directives = emptyList(), | |
) |
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.
Exactly - good catch! 👍
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.
Mmm looks like that failed in apiCheck
because the method is marked as 'synthetic'. I think this is ok though cause it's still binary compatible.
...pollo-ast/src/main/kotlin/com/apollographql/apollo3/ast/introspection/IntrospectionSchema.kt
Show resolved
Hide resolved
...o-ast/src/main/kotlin/com/apollographql/apollo3/ast/introspection/introspection_to_schema.kt
Show resolved
Hide resolved
...lo-gradle-plugin/src/test/kotlin/com/apollographql/apollo3/gradle/test/ConvertSchemaTests.kt
Outdated
Show resolved
Hide resolved
...lo-gradle-plugin/src/test/kotlin/com/apollographql/apollo3/gradle/test/ConvertSchemaTests.kt
Outdated
Show resolved
Hide resolved
...o-gradle-plugin/src/test/kotlin/com/apollographql/apollo3/gradle/test/DownloadSchemaTests.kt
Show resolved
Hide resolved
libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/SchemaDownloader.kt
Show resolved
Hide resolved
…/ast/introspection/IntrospectionSchema.kt Co-authored-by: Martin Bonnin <[email protected]>
…/ast/introspection/IntrospectionSchema.kt Co-authored-by: Martin Bonnin <[email protected]>
…ql/apollo3/gradle/test/ConvertSchemaTests.kt Co-authored-by: Martin Bonnin <[email protected]>
…ql/apollo3/gradle/test/ConvertSchemaTests.kt Co-authored-by: Martin Bonnin <[email protected]>
Co-authored-by: Martin Bonnin <[email protected]> (cherry picked from commit f5b68a4)
See #4699