Class SchemaPrinter
java.lang.Object
graphql.schema.idl.SchemaPrinter
This can print an in memory GraphQL schema back to a logical schema definition
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classOptions to use when printing a schemaprivate static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionThis predicate excludes all directives which are specified by the GraphQL Specification.private final SchemaPrinter.Optionsprivate final Map<Class<?>, SchemaPrinter.SchemaElementPrinter<?>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate List<GraphQLAppliedDirective> addDeprecatedDirectiveIfNeeded(GraphQLDirectiveContainer directiveContainer) (package private) StringargsString(Class<? extends GraphQLSchemaElement> parent, List<GraphQLArgument> arguments) (package private) StringargsString(List<GraphQLArgument> arguments) private String(package private) Stringdescription(String runtimeDescription, Description descriptionAst) private StringdirectiveDefinition(GraphQLDirective directive) (package private) StringdirectivesString(Class<? extends GraphQLSchemaElement> parentType, boolean isDeprecated, GraphQLDirectiveContainer directiveContainer) directivesString(Class<? extends GraphQLSchemaElement> parentType, GraphQLDirectiveContainer directiveContainer) private StringdirectivesString(Class<? extends GraphQLSchemaElement> parentType, List<GraphQLAppliedDirective> directives) private StringdirectiveString(GraphQLAppliedDirective directive) private StringgetAstDefinitionComments(Object commentHolder) private Comparator<? super GraphQLSchemaElement> getComparator(Class<? extends GraphQLSchemaElement> parentType, Class<? extends GraphQLSchemaElement> elementType) private StringgetDeprecationReason(GraphQLDirectiveContainer directiveContainer) private StringgetDescription(Object descriptionHolder) private List<GraphQLDirective> getSchemaDirectives(GraphQLSchema schema) private booleanhasAstDefinitionComments(Object commentHolder) private booleanhasDeprecatedDirective(List<GraphQLAppliedDirective> directives) private booleanhasDescription(Object descriptionHolder) private booleanisDeprecatedDirective(GraphQLAppliedDirective directive) private booleanprivate static booleanThis can print an in memory GraphQL IDL document back to a logical schema definition.print(GraphQLDirective graphQLDirective) print(GraphQLSchema schema) This can print an in memory GraphQL schema back to a logical schema definitionprint(GraphQLType type) print(List<GraphQLSchemaElement> elements) private voidprintAsAst(PrintWriter out, TypeDefinition<?> definition, List<? extends TypeDefinition<?>> extensions) This will print out a runtime graphql schema element using its contained AST type definition.private static StringprintAst(InputValueWithState value, GraphQLInputType type) private voidprintComments(PrintWriter out, Object graphQLType, String prefix) private StringprintComments(Object graphQLType, String prefix) private <T> SchemaPrinter.SchemaElementPrinter<T> private voidprintFieldDefinitions(PrintWriter out, Comparator<? super GraphQLSchemaElement> comparator, List<GraphQLFieldDefinition> fieldDefinitions) private voidprintMultiLineDescription(PrintWriter out, String prefix, List<String> lines) private voidprintMultiLineHashDescription(PrintWriter out, String prefix, List<String> lines) private voidprintSchemaElement(PrintWriter out, GraphQLSchemaElement schemaElement, GraphqlFieldVisibility visibility) private voidprintSingleLineDescription(PrintWriter out, String prefix, String s) private booleanshouldPrintAsAst(TypeDefinition<?> definition) This will return true if the options say to use the AST and we have an AST elementprivate static String(package private) StringtypeString(GraphQLType rawType)
-
Field Details
-
ExcludeGraphQLSpecifiedDirectivesPredicate
-
printers
-
options
-
-
Constructor Details
-
SchemaPrinter
public SchemaPrinter() -
SchemaPrinter
-
-
Method Details
-
print
This can print an in memory GraphQL IDL document back to a logical schema definition. If you want to turn a Introspection query result into a Document (and then into a printed schema) then useIntrospectionResultToSchema.createSchemaDefinition(java.util.Map)first to get theDocumentand then print that.- Parameters:
schemaIDL- the parsed schema IDL- Returns:
- the logical schema definition
-
print
This can print an in memory GraphQL schema back to a logical schema definition- Parameters:
schema- the schema in play- Returns:
- the logical schema definition
-
isIntrospectionType
-
scalarPrinter
-
enumPrinter
-
printFieldDefinitions
private void printFieldDefinitions(PrintWriter out, Comparator<? super GraphQLSchemaElement> comparator, List<GraphQLFieldDefinition> fieldDefinitions) -
interfacePrinter
-
unionPrinter
-
directivePrinter
-
objectPrinter
-
inputObjectPrinter
-
shouldPrintAsAst
This will return true if the options say to use the AST and we have an AST element- Parameters:
definition- the AST type definition- Returns:
- true if we should print using AST nodes
-
printAsAst
private void printAsAst(PrintWriter out, TypeDefinition<?> definition, List<? extends TypeDefinition<?>> extensions) This will print out a runtime graphql schema element using its contained AST type definition. This must be guarded by a called toshouldPrintAsAst(TypeDefinition)- Parameters:
out- the output writerdefinition- the AST type definitionextensions- a list of type definition extensions
-
printAst
-
schemaPrinter
-
getSchemaDirectives
-
typeString
-
argsString
-
argsString
-
directivesString
public String directivesString(Class<? extends GraphQLSchemaElement> parentType, GraphQLDirectiveContainer directiveContainer) -
directivesString
String directivesString(Class<? extends GraphQLSchemaElement> parentType, boolean isDeprecated, GraphQLDirectiveContainer directiveContainer) -
directivesString
private String directivesString(Class<? extends GraphQLSchemaElement> parentType, List<GraphQLAppliedDirective> directives) -
directiveString
-
isDeprecatedDirective
-
hasDeprecatedDirective
-
addDeprecatedDirectiveIfNeeded
private List<GraphQLAppliedDirective> addDeprecatedDirectiveIfNeeded(GraphQLDirectiveContainer directiveContainer) -
getDeprecationReason
-
directiveDefinition
-
printer
-
print
-
print
-
print
-
printSchemaElement
private void printSchemaElement(PrintWriter out, GraphQLSchemaElement schemaElement, GraphqlFieldVisibility visibility) -
printComments
-
printComments
-
printMultiLineHashDescription
-
printMultiLineDescription
-
printSingleLineDescription
-
hasAstDefinitionComments
-
getAstDefinitionComments
-
comments
-
hasDescription
-
getDescription
-
description
-
getComparator
private Comparator<? super GraphQLSchemaElement> getComparator(Class<? extends GraphQLSchemaElement> parentType, Class<? extends GraphQLSchemaElement> elementType) -
trimNewLineChars
-
isNullOrEmpty
-