Skip to content

fix(client): Include deprecated input fields in introspection query - #2195

Merged
samuelAndalon merged 1 commit into
masterfrom
deprecated-introspection-input-fields
Jul 1, 2026
Merged

fix(client): Include deprecated input fields in introspection query#2195
samuelAndalon merged 1 commit into
masterfrom
deprecated-introspection-input-fields

Conversation

@mgilbey

@mgilbey mgilbey commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

📝 Description

If an introspection query runs against a schema where all fields on an object are deprecated then an empty object is returned which will fail to print via graphql-java when doing SchemaPrinter(options).print(graphQLDocument) which is done in the graphql-kotlin client. By including those deprecated fields, we avoid the invalid object.

Stack trace example:

Caused by: graphql.schema.validation.InvalidSchemaException: invalid schema:
"InputTypeWithAllDeprecatedFields" must define one or more fields.
        at graphql.schema.GraphQLSchema$Builder.validateSchema(GraphQLSchema.java:886)
        at graphql.schema.GraphQLSchema$Builder.buildImpl(GraphQLSchema.java:874)
        at graphql.schema.GraphQLSchema$Builder.build(GraphQLSchema.java:841)
        at graphql.schema.idl.SchemaGenerator.makeExecutableSchemaImpl(SchemaGenerator.java:143)
        at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:113)
        at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:84)
        at graphql.schema.idl.UnExecutableSchemaGenerator.makeUnExecutableSchema(UnExecutableSchemaGenerator.java:28)
        at graphql.schema.idl.SchemaPrinter.print(SchemaPrinter.java:496)
        at com.expediagroup.graphql.plugin.client.IntrospectSchemaKt$introspectSchema$2$1.invokeSuspend(introspectSchema.kt:182)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277)
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:95)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:69)
        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48)
        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
        at com.expediagroup.graphql.plugin.client.IntrospectSchemaKt.introspectSchema(introspectSchema.kt:150)
        at com.expediagroup.graphql.plugin.gradle.actions.IntrospectSchemaAction.execute(IntrospectSchemaAction.kt:37)

And an example schema that causes the problem:

schema {
  query: Query
}

type Query {
  hello(input: HelloInput): String!
}

input HelloInput {
  legacyField: String @deprecated(reason: "Use `newField` instead.")
}

🔗 Related Issues

If an introspection query runs against a schema where all fields on an object are deprecated then an empty object is returned which will fail to print via graphql-java when doing `SchemaPrinter(options).print(graphQLDocument)` which is done in the graphql-kotlin client. By including those deprecated fields, we avoid the invalid object.

Stack trace example:

```
Caused by: graphql.schema.validation.InvalidSchemaException: invalid schema:
"InputTypeWithAllDeprecatedFields" must define one or more fields.
        at graphql.schema.GraphQLSchema$Builder.validateSchema(GraphQLSchema.java:886)
        at graphql.schema.GraphQLSchema$Builder.buildImpl(GraphQLSchema.java:874)
        at graphql.schema.GraphQLSchema$Builder.build(GraphQLSchema.java:841)
        at graphql.schema.idl.SchemaGenerator.makeExecutableSchemaImpl(SchemaGenerator.java:143)
        at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:113)
        at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:84)
        at graphql.schema.idl.UnExecutableSchemaGenerator.makeUnExecutableSchema(UnExecutableSchemaGenerator.java:28)
        at graphql.schema.idl.SchemaPrinter.print(SchemaPrinter.java:496)
        at com.expediagroup.graphql.plugin.client.IntrospectSchemaKt$introspectSchema$2$1.invokeSuspend(introspectSchema.kt:182)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277)
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:95)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:69)
        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48)
        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
        at com.expediagroup.graphql.plugin.client.IntrospectSchemaKt.introspectSchema(introspectSchema.kt:150)
        at com.expediagroup.graphql.plugin.gradle.actions.IntrospectSchemaAction.execute(IntrospectSchemaAction.kt:37)
```

And an example schema that causes the problem
```
schema {
  query: Query
}

type Query {
  hello(input: HelloInput): String!
}

input HelloInput {
  legacyField: String @deprecated(reason: "Use `newField` instead.")
}
```
@samuelAndalon
samuelAndalon self-requested a review July 1, 2026 16:02
@samuelAndalon
samuelAndalon merged commit c2daee5 into master Jul 1, 2026
8 checks passed
@samuelAndalon
samuelAndalon deleted the deprecated-introspection-input-fields branch July 1, 2026 16:03
samuelAndalon added a commit that referenced this pull request Jul 1, 2026
…2198)

cherry pick #2195

Co-authored-by: Martin Gilbey <mgilbey@expedia.com>
samuelAndalon pushed a commit that referenced this pull request Jul 2, 2026
…ere all fields are deprecated (#2200)

### 📝 Description

Adds a test case to prevent regression on #2195 

### 🔗 Related Issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants