Class KobbySchemaTruncateExtension
-
- All Implemented Interfaces:
public class KobbySchemaTruncateExtensionGraphQL 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).
-
-
Field Summary
Fields Modifier and Type Field Description private BooleanreportEnabledprivate BooleanregexEnabledprivate BooleancaseSensitive
-
Constructor Summary
Constructors Constructor Description KobbySchemaTruncateExtension()
-
Method Summary
Modifier and Type Method Description final BooleangetReportEnabled()Print detailed schema truncation report to console. final UnitsetReportEnabled(Boolean reportEnabled)Print detailed schema truncation report to console. final BooleangetRegexEnabled()Is Regex enabled in GraphQL schema truncation query. final UnitsetRegexEnabled(Boolean regexEnabled)Is Regex enabled in GraphQL schema truncation query. final BooleangetCaseSensitive()Are patterns used in a GraphQL schema truncation query case sensitive. final UnitsetCaseSensitive(Boolean caseSensitive)Are patterns used in a GraphQL schema truncation query case sensitive. final UnitbyQuery(Action<KobbySchemaQueryExtension> action)A query used to truncate the GraphQL schema before generating code. -
-
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 forQuerytype.__mutation- alias forMutationtype.__subscription- alias forSubscriptiontype.__root- alias forQuery,MutationandSubscriptiontypes.__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 forQuerytype.__mutation- alias forMutationtype.__subscription- alias forSubscriptiontype.__root- alias forQuery,MutationandSubscriptiontypes.__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
forXXXconditions will be stored in the truncated schema. For example the truncation by the query:byQuery { forMutation { exclude { field("*") } } }will remove all fields from the
Mutationtype, but keep all fields in other types.Default:
byQuery { forAny { include { field("*") } } }
-
-
-
-