Class KobbySchemaTruncateExtension

  • All Implemented Interfaces:

    
    public class KobbySchemaTruncateExtension
    
                        

    GraphQL schema truncation configuration. This mechanism provides the ability to truncate the GraphQL schema before code generation.

    Schema truncation occurs in two stages:

    • The first stage preserves all GraphQL fields that match the truncation query in the schema and removes all other fields.

    • The second stage removes all GraphQL types from the schema that are not accessible from the schema root (Query, Mutation or Subscription types).

    • Constructor Detail

      • KobbySchemaTruncateExtension

        KobbySchemaTruncateExtension()
    • Method Detail

      • getReportEnabled

         final Boolean getReportEnabled()

        Print detailed schema truncation report to console.

        Default: false

      • setReportEnabled

         final Unit setReportEnabled(Boolean reportEnabled)

        Print detailed schema truncation report to console.

        Default: false

      • getRegexEnabled

         final Boolean getRegexEnabled()

        Is Regex enabled in GraphQL schema truncation query. By default, a simplified Kobby Pattern is used:

        • ? - matches one character.

        • * - matches zero or more characters.

        • | - OR operator.

        • __query - alias for Query type.

        • __mutation - alias for Mutation type.

        • __subscription - alias for Subscription type.

        • __root - alias for Query, Mutation and Subscription types.

        • __any - alias for any type in the GraphQL schema.

        • __anyScalar - alias for any scalar in the GraphQL schema.

        • __anyObject - alias for any object in the GraphQL schema.

        • __anyInterface - alias for any interface in the GraphQL schema.

        • __anyUnion - alias for any union in the GraphQL schema.

        • __anyEnum - alias for any enum in the GraphQL schema.

        • __anyInput - alias for any input object in the GraphQL schema.

        Default: false

      • setRegexEnabled

         final Unit setRegexEnabled(Boolean regexEnabled)

        Is Regex enabled in GraphQL schema truncation query. By default, a simplified Kobby Pattern is used:

        • ? - matches one character.

        • * - matches zero or more characters.

        • | - OR operator.

        • __query - alias for Query type.

        • __mutation - alias for Mutation type.

        • __subscription - alias for Subscription type.

        • __root - alias for Query, Mutation and Subscription types.

        • __any - alias for any type in the GraphQL schema.

        • __anyScalar - alias for any scalar in the GraphQL schema.

        • __anyObject - alias for any object in the GraphQL schema.

        • __anyInterface - alias for any interface in the GraphQL schema.

        • __anyUnion - alias for any union in the GraphQL schema.

        • __anyEnum - alias for any enum in the GraphQL schema.

        • __anyInput - alias for any input object in the GraphQL schema.

        Default: false

      • getCaseSensitive

         final Boolean getCaseSensitive()

        Are patterns used in a GraphQL schema truncation query case sensitive.

        Default: true

      • setCaseSensitive

         final Unit setCaseSensitive(Boolean caseSensitive)

        Are patterns used in a GraphQL schema truncation query case sensitive.

        Default: true

      • byQuery

         final Unit byQuery(Action<KobbySchemaQueryExtension> action)

        A query used to truncate the GraphQL schema before generating code.

        All GraphQL type fields that match this query should be stored in the truncated schema. All other fields will be removed from the truncated schema.

        Then, all GraphQL types that are not accessible from the schema root (Query, Mutation, or Subscription types) will also be removed from the GraphQL schema.

        When performing a truncate operation, all fields of all types that do not match any of the forXXX conditions will be stored in the truncated schema. For example the truncation by the query:

        byQuery {
            forMutation {
                exclude {
                    field("*")
                }
            }
        }

        will remove all fields from the Mutation type, but keep all fields in other types.

        Default:

        byQuery {
            forAny {
                include {
                    field("*")
                }
            }
        }