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

com.expedia.graphql.toSchema.kt Maven / Gradle / Ivy

There is a newer version: 0.0.26
Show newest version
package com.expedia.graphql

import com.expedia.graphql.schema.SchemaGeneratorConfig
import com.expedia.graphql.schema.exceptions.InvalidSchemaException
import com.expedia.graphql.schema.generator.SchemaGenerator
import graphql.schema.GraphQLSchema

/**
 * Entry point to generate a graphql schema using reflection on the passed objects.
 *
 * @param queries List of [TopLevelObjectDef] objects to use for GraphQL queries
 * @param mutations List of [TopLevelObjectDef] objects to use for GraphQL mutations
 * @param config Schema generation configuration
 */
fun toSchema(
    queries: List,
    mutations: List = emptyList(),
    config: SchemaGeneratorConfig
): GraphQLSchema {
    if (queries.isEmpty()) {
        throw InvalidSchemaException()
    }
    return SchemaGenerator(queries, mutations, config).generate()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy