Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphql-java-tools</artifactId>
<version>6.0.3-SNAPSHOT</version>
<version>6.1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>GraphQL Java Tools</name>
Expand Down
7 changes: 1 addition & 6 deletions src/main/kotlin/graphql/kickstart/tools/SchemaObjects.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import graphql.schema.GraphQLCodeRegistry
import graphql.schema.GraphQLObjectType
import graphql.schema.GraphQLSchema
import graphql.schema.GraphQLType
import graphql.schema.visibility.NoIntrospectionGraphqlFieldVisibility

/**
* @author Andrew Potter
Expand All @@ -14,11 +13,7 @@ data class SchemaObjects(val query: GraphQLObjectType, val mutation: GraphQLObje
/**
* Makes a GraphQLSchema with query, mutation and subscription.
*/
fun toSchema(introspectionEnabled: Boolean): GraphQLSchema {
if (!introspectionEnabled) {
codeRegistryBuilder.fieldVisibility(NoIntrospectionGraphqlFieldVisibility.NO_INTROSPECTION_FIELD_VISIBILITY)
}

fun toSchema(): GraphQLSchema {
return GraphQLSchema.newSchema()
.query(query)
.mutation(mutation)
Expand Down
9 changes: 7 additions & 2 deletions src/main/kotlin/graphql/kickstart/tools/SchemaParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import graphql.schema.*
import graphql.schema.idl.RuntimeWiring
import graphql.schema.idl.ScalarInfo
import graphql.schema.idl.SchemaGeneratorHelper
import graphql.schema.visibility.NoIntrospectionGraphqlFieldVisibility
import org.slf4j.LoggerFactory
import java.util.*
import kotlin.reflect.KClass
Expand Down Expand Up @@ -62,9 +63,13 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
* Parses the given schema with respect to the given dictionary and returns GraphQL objects.
*/
fun parseSchemaObjects(): SchemaObjects {
if (!options.introspectionEnabled) {
codeRegistryBuilder.fieldVisibility(NoIntrospectionGraphqlFieldVisibility.NO_INTROSPECTION_FIELD_VISIBILITY)
}
// this overrides the above introspection enabled setting obviously... todo: add documentation
options.fieldVisilibity?.let { codeRegistryBuilder.fieldVisibility(it) }

// Create GraphQL objects
// val inputObjects = inputObjectDefinitions.map { createInputObject(it, listOf())}
val inputObjects: MutableList<GraphQLInputObjectType> = mutableListOf()
inputObjectDefinitions.forEach {
if (inputObjects.none { io -> io.name == it.name }) {
Expand Down Expand Up @@ -101,7 +106,7 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
/**
* Parses the given schema with respect to the given dictionary and returns a GraphQLSchema
*/
fun makeExecutableSchema(): GraphQLSchema = parseSchemaObjects().toSchema(options.introspectionEnabled)
fun makeExecutableSchema(): GraphQLSchema = parseSchemaObjects().toSchema()

/**
* Returns any unused type definitions that were found in the schema
Expand Down
Loading