com.coxautodev.graphql.tools.SchemaObjects.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of graphql-java-tools Show documentation
Show all versions of graphql-java-tools Show documentation
Tools to help map a GraphQL schema to existing Java objects.
The newest version!
package com.coxautodev.graphql.tools
import graphql.schema.GraphQLObjectType
import graphql.schema.GraphQLSchema
import graphql.schema.GraphQLType
/**
* @author Andrew Potter
*/
data class SchemaObjects(val query: GraphQLObjectType, val mutation: GraphQLObjectType?, val subscription: GraphQLObjectType?, val dictionary: Set) {
/**
* Makes a GraphQLSchema with query, mutation and subscription.
*/
fun toSchema(): GraphQLSchema = GraphQLSchema.newSchema()
.query(query)
.mutation(mutation)
.subscription(subscription)
.build(dictionary)
/**
* Makes a GraphQLSchema with query but without mutation and subscription.
*/
fun toReadOnlySchema(): GraphQLSchema = GraphQLSchema.newSchema()
.query(query)
.build(dictionary)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy