Skip to content
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

Select all types in pre-introspection query #5547

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ import com.apollographql.apollo3.ast.toFullSchemaGQLDocument
import com.apollographql.apollo3.ast.toGQLDocument
import com.apollographql.apollo3.ast.toSDL
import com.apollographql.apollo3.ast.toUtf8
import com.apollographql.apollo3.exception.ApolloHttpException
import com.apollographql.apollo3.network.okHttpClient
import com.apollographql.apollo3.tooling.SchemaHelper.reworkFullTypeFragment
import com.apollographql.apollo3.tooling.SchemaHelper.reworkInputValueFragment
import com.apollographql.apollo3.tooling.SchemaHelper.reworkIntrospectionQuery
import com.apollographql.apollo3.tooling.graphql.PreIntrospectionQuery
import com.apollographql.apollo3.tooling.platformapi.public.DownloadSchemaQuery
import kotlinx.coroutines.runBlocking
import okio.buffer
Expand Down Expand Up @@ -141,12 +139,16 @@ object SchemaDownloader {
headers: Map<String, String>,
insecure: Boolean,
): String {
val preIntrospectionData: PreIntrospectionQuery.Data = SchemaHelper.executePreIntrospectionQuery(
endpoint = endpoint,
headers = headers,
insecure = insecure,
)
val features = preIntrospectionData.getFeatures()
val features = try {
SchemaHelper.executePreIntrospectionQuery(
endpoint = endpoint,
headers = headers,
insecure = insecure,
).getFeatures()
} catch (e: Exception) {
// Some servers (e.g. api.github.com) don't support the pre-introspection query, fallback to the minimal set of features
emptySet()
}
val introspectionQuery = getIntrospectionQuery(features)
return SchemaHelper.executeIntrospectionQuery(
introspectionQuery = introspectionQuery,
Expand Down