Skip to content

Deprecate the introspectionEnabled option and remove it in 15.0.0 #858

Open

Description

@oryan-block

SchemaParserOptions.introspectionEnabled(false) turns off introspection with a field visibility that hides every field of the introspection types (__Schema, __Type, ...). Until #849 that was graphql-java's NoIntrospectionGraphqlFieldVisibility, which graphql-java deprecated in v22 (graphql-java/graphql-java#3526):

NoIntrospectionGraphqlFieldVisibility is another way to do this but it does not allow dynamic on or off and it makes the schema invalid according to spec.

Their replacement checks __schema and __type when the query runs and returns an "introspection disabled" error. It has two switches:

  • Introspection.enabledJvmWide(false) for the whole JVM
  • Introspection.INTROSPECTION_DISABLED in the GraphQLContext of a single request

We can't use either one from the library. We don't execute requests, so we can't set the context key, and calling enabledJvmWide(false) from SchemaParser would also turn introspection off for every other schema in the app. So #849 swapped NoIntrospectionGraphqlFieldVisibility for the BlockedFields it wraps, which keeps the old behaviour, including its problems. Apps can use the graphql-java switches directly, so we should point them there and drop the option.

What to change

  • deprecate SchemaParserOptions.Builder.introspectionEnabled(...) and the introspectionEnabled property in a 14.x release, pointing to the two switches
  • in 15.0.0, remove both, the BlockedFields block in SchemaParser.parseSchemaObjects and the tests in IntrospectionTest that turn it off

Migration

// before
SchemaParserOptions.newOptions().introspectionEnabled(false)
// after, for the whole JVM
Introspection.enabledJvmWide(false)
// after, per request
ExecutionInput.newExecutionInput()
    .query(query)
    .graphQLContext(mapOf(Introspection.INTROSPECTION_DISABLED to true))

With the graphql-java switches, an introspection query fails with an "introspection disabled" error when it runs, instead of the FieldUndefined validation error it gets now.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions