Class ExecutableNormalizedOperationToAstCompiler
ExecutableNormalizedField
s and compiling out a
normalised operation Document
that would represent how those fields
may be executed.
This is essentially the reverse of ExecutableNormalizedOperationFactory
which takes
operation text and makes ExecutableNormalizedField
s from it, this takes ExecutableNormalizedField
s
and makes operation text from it.
You could for example send that operation text onto to some other graphql server if it has the same schema as the one provided.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
The result is aDocument
and a map of variables that would go with that document. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncompileToDocument
(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable String operationName, @NonNull List<ExecutableNormalizedField> topLevelFields, @Nullable VariablePredicate variablePredicate) This will compile an operation textDocument
with possibly variables from the givenExecutableNormalizedField
scompileToDocument
(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable String operationName, @NonNull List<ExecutableNormalizedField> topLevelFields, @NonNull Map<ExecutableNormalizedField, QueryDirectives> normalizedFieldToQueryDirectives, @Nullable VariablePredicate variablePredicate) This will compile an operation textDocument
with possibly variables from the givenExecutableNormalizedField
scompileToDocumentWithDeferSupport
(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable String operationName, @NonNull List<ExecutableNormalizedField> topLevelFields, @Nullable VariablePredicate variablePredicate) This will compile an operation textDocument
with possibly variables from the givenExecutableNormalizedField
s, with support for the experimental @defer directive.compileToDocumentWithDeferSupport
(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable String operationName, @NonNull List<ExecutableNormalizedField> topLevelFields, @NonNull Map<ExecutableNormalizedField, QueryDirectives> normalizedFieldToQueryDirectives, @Nullable VariablePredicate variablePredicate) This will compile an operation textDocument
with possibly variables from the givenExecutableNormalizedField
s, with support for the experimental @defer directive.
-
Constructor Details
-
ExecutableNormalizedOperationToAstCompiler
public ExecutableNormalizedOperationToAstCompiler()
-
-
Method Details
-
compileToDocument
public static ExecutableNormalizedOperationToAstCompiler.CompilerResult compileToDocument(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable String operationName, @NonNull List<ExecutableNormalizedField> topLevelFields, @Nullable VariablePredicate variablePredicate) This will compile an operation textDocument
with possibly variables from the givenExecutableNormalizedField
sThe
VariablePredicate
is used called to decide if the given argument values should be made into a variable OR inlined into the operation text as a graphql literal.- Parameters:
schema
- the graphql schema to useoperationKind
- the kind of operationoperationName
- the name of the operation to usetopLevelFields
- the top levelExecutableNormalizedField
s to start fromvariablePredicate
- the variable predicate that decides if arguments turn into variables or not during compilation- Returns:
- a
ExecutableNormalizedOperationToAstCompiler.CompilerResult
object
-
compileToDocument
public static ExecutableNormalizedOperationToAstCompiler.CompilerResult compileToDocument(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable String operationName, @NonNull List<ExecutableNormalizedField> topLevelFields, @NonNull Map<ExecutableNormalizedField, QueryDirectives> normalizedFieldToQueryDirectives, @Nullable VariablePredicate variablePredicate) This will compile an operation textDocument
with possibly variables from the givenExecutableNormalizedField
sThe
VariablePredicate
is used called to decide if the given argument values should be made into a variable OR inlined into the operation text as a graphql literal.- Parameters:
schema
- the graphql schema to useoperationKind
- the kind of operationoperationName
- the name of the operation to usetopLevelFields
- the top levelExecutableNormalizedField
s to start fromnormalizedFieldToQueryDirectives
- the map of normalized field to query directivesvariablePredicate
- the variable predicate that decides if arguments turn into variables or not during compilation- Returns:
- a
ExecutableNormalizedOperationToAstCompiler.CompilerResult
object
-
compileToDocumentWithDeferSupport
@ExperimentalApi public static ExecutableNormalizedOperationToAstCompiler.CompilerResult compileToDocumentWithDeferSupport(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable String operationName, @NonNull List<ExecutableNormalizedField> topLevelFields, @Nullable VariablePredicate variablePredicate) This will compile an operation textDocument
with possibly variables from the givenExecutableNormalizedField
s, with support for the experimental @defer directive.The
VariablePredicate
is used called to decide if the given argument values should be made into a variable OR inlined into the operation text as a graphql literal.- Parameters:
schema
- the graphql schema to useoperationKind
- the kind of operationoperationName
- the name of the operation to usetopLevelFields
- the top levelExecutableNormalizedField
s to start fromvariablePredicate
- the variable predicate that decides if arguments turn into variables or not during compilation- Returns:
- a
ExecutableNormalizedOperationToAstCompiler.CompilerResult
object - See Also:
-
compileToDocumentWithDeferSupport
@ExperimentalApi public static ExecutableNormalizedOperationToAstCompiler.CompilerResult compileToDocumentWithDeferSupport(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable String operationName, @NonNull List<ExecutableNormalizedField> topLevelFields, @NonNull Map<ExecutableNormalizedField, QueryDirectives> normalizedFieldToQueryDirectives, @Nullable VariablePredicate variablePredicate) This will compile an operation textDocument
with possibly variables from the givenExecutableNormalizedField
s, with support for the experimental @defer directive.The
VariablePredicate
is used called to decide if the given argument values should be made into a variable OR inlined into the operation text as a graphql literal.- Parameters:
schema
- the graphql schema to useoperationKind
- the kind of operationoperationName
- the name of the operation to usetopLevelFields
- the top levelExecutableNormalizedField
s to start fromnormalizedFieldToQueryDirectives
- the map of normalized field to query directivesvariablePredicate
- the variable predicate that decides if arguments turn into variables or not during compilation- Returns:
- a
ExecutableNormalizedOperationToAstCompiler.CompilerResult
object - See Also:
-