All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.coxautodev.graphql.tools.SchemaObjects.kt Maven / Gradle / Ivy

There is a newer version: 5.2.4
Show 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 dictionary: Set) {

    /**
     * Makes a GraphQLSchema with query and mutation.
     */
    fun toSchema(): GraphQLSchema = GraphQLSchema.newSchema()
        .query(query)
        .mutation(mutation)
        .build(dictionary)

    /**
     * Makes a GraphQLSchema with query but without mutation.
     */
    fun toReadOnlySchema(): GraphQLSchema = GraphQLSchema.newSchema()
        .query(query)
        .build(dictionary)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy