Class GraphQLSchemaParser
java.lang.Object
org.brapi.schematools.core.graphql.GraphQLSchemaParser
Parser for converting the result of a introspection query into a GraphQLSchema,
and vice versa.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Parser with a standard ObjectMapperGraphQLSchemaParser(com.fasterxml.jackson.databind.ObjectMapper mapper) Creates a new Parser with a predefined ObjectMapper -
Method Summary
Modifier and TypeMethodDescriptiongraphql.schema.GraphQLSchemaparseJsonSchema(String jsonSchema) Parses the result of an introspection query into a GraphQLSchema.writeSchemaToString(graphql.schema.GraphQLSchema schema) Writes the schema to a String.
-
Constructor Details
-
GraphQLSchemaParser
public GraphQLSchemaParser()Creates a new Parser with a standard ObjectMapper -
GraphQLSchemaParser
public GraphQLSchemaParser(com.fasterxml.jackson.databind.ObjectMapper mapper) Creates a new Parser with a predefined ObjectMapper- Parameters:
mapper- a predefined ObjectMapper
-
-
Method Details
-
parseJsonSchema
public graphql.schema.GraphQLSchema parseJsonSchema(String jsonSchema) throws com.fasterxml.jackson.core.JsonProcessingException Parses the result of an introspection query into a GraphQLSchema. Note the schema is not executable.- Parameters:
jsonSchema- the result of an introspection query into a GraphQLSchema- Returns:
- A GraphQLSchema generated from the result of an introspection query
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- if there is a problem reading the schema as a valid JSON object.
-
writeSchemaToString
public String writeSchemaToString(graphql.schema.GraphQLSchema schema) throws com.fasterxml.jackson.core.JsonProcessingException Writes the schema to a String.- Parameters:
schema- A GraphQLSchema generated from the result of an introspection query- Returns:
- A string version of the JSON representing a GraphQLSchema generated from the result of an introspection query
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- if there is a problem writing the schema as a valid JSON object.
-