com.expedia.graphql.toSchema.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of graphql-kotlin Show documentation
Show all versions of graphql-kotlin Show documentation
Code-only GraphQL schema generation for Kotlin
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