Interface SchemaMappingInspector.Initializer

Enclosing class:
SchemaMappingInspector

public static interface SchemaMappingInspector.Initializer
Helps to configure SchemaMappingInspector.
Since:
1.3.0
Author:
Brian Clozel, Rossen Stoyanchev
  • Method Details

    • classMapping

      SchemaMappingInspector.Initializer classMapping(String graphQlTypeName, Class<?>... aClass)
      Provide an explicit mapping between a GraphQL type name and the Java class(es) that represent it at runtime to help inspect union member and interface implementation types when those associations cannot be discovered otherwise.

      Out of the box, there a several ways through which schema inspection can locate such types automatically:

      • Java class representations are located in the same package as the type returned from the controller method for a union or interface field, and their simple class names match GraphQL type names, possibly with the help of a classNameFunction(java.util.function.Function<graphql.schema.GraphQLObjectType, java.lang.String>).
      • Java class representations are located in the same package as the declaring class of the controller method for a union or interface field.
      • Controller methods return the Java class representations of schema fields for concrete union member or interface implementation types.
      Parameters:
      graphQlTypeName - the name of a GraphQL Object type
      aClass - one or more Java class representations
      Returns:
      the same initializer instance
    • classNameFunction

      SchemaMappingInspector.Initializer classNameFunction(Function<graphql.schema.GraphQLObjectType, String> function)
      Help to derive the simple class name for the Java representation of a GraphQL union member or interface implementing type. For more details, see classMapping(String, Class[]).

      By default, GraphQLObjectType.getName() is used.

      Parameters:
      function - the function to use
      Returns:
      the same initializer instance
    • classResolver

      Alternative to classMapping(String, Class[]) with a custom SchemaMappingInspector.ClassResolver to find the Java class(es) for a GraphQL union member or interface implementation type.
      Parameters:
      resolver - the resolver to use to find associated Java classes
      Returns:
      the same initializer instance
    • inspect

      SchemaReport inspect(graphql.schema.GraphQLSchema schema, Map<String, Map<String, graphql.schema.DataFetcher>> fetchers)
      Perform the inspection and return a report.
      Parameters:
      schema - the schema to inspect
      fetchers - the registered data fetchers
      Returns:
      the produced report