Skip to content

Commit

Permalink
Merge branch '3.2.x'
Browse files Browse the repository at this point in the history
Closes gh-40016
  • Loading branch information
bclozel committed Mar 19, 2024
2 parents 9416121 + dc2c253 commit e3f8c34
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
Expand Up @@ -25,8 +25,7 @@

import graphql.GraphQL;
import graphql.execution.instrumentation.Instrumentation;
import graphql.schema.idl.RuntimeWiring.Builder;
import graphql.schema.visibility.NoIntrospectionGraphqlFieldVisibility;
import graphql.introspection.Introspection;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

Expand Down Expand Up @@ -108,18 +107,14 @@ public GraphQlSource graphQlSource(ResourcePatternResolver resourcePatternResolv
builder.inspectSchemaMappings(logger::info);
}
if (!properties.getSchema().getIntrospection().isEnabled()) {
builder.configureRuntimeWiring(this::enableIntrospection);
Introspection.enabledJvmWide(false);
}
builder.configureTypeDefinitions(new ConnectionTypeDefinitionConfigurer());
wiringConfigurers.orderedStream().forEach(builder::configureRuntimeWiring);
sourceCustomizers.orderedStream().forEach((customizer) -> customizer.customize(builder));
return builder.build();
}

private Builder enableIntrospection(Builder wiring) {
return wiring.fieldVisibility(NoIntrospectionGraphqlFieldVisibility.NO_INTROSPECTION_FIELD_VISIBILITY);
}

private Resource[] resolveSchemaResources(ResourcePatternResolver resolver, String[] locations,
String[] extensions) {
List<Resource> resources = new ArrayList<>();
Expand Down
Expand Up @@ -22,12 +22,12 @@
import graphql.GraphQL;
import graphql.execution.instrumentation.ChainedInstrumentation;
import graphql.execution.instrumentation.Instrumentation;
import graphql.introspection.Introspection;
import graphql.schema.GraphQLObjectType;
import graphql.schema.GraphQLOutputType;
import graphql.schema.GraphQLSchema;
import graphql.schema.idl.RuntimeWiring;
import graphql.schema.visibility.DefaultGraphqlFieldVisibility;
import graphql.schema.visibility.NoIntrospectionGraphqlFieldVisibility;
import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -183,8 +183,7 @@ void shouldDisableFieldIntrospection() {
this.contextRunner.withPropertyValues("spring.graphql.schema.introspection.enabled:false").run((context) -> {
GraphQlSource graphQlSource = context.getBean(GraphQlSource.class);
GraphQLSchema schema = graphQlSource.schema();
assertThat(schema.getCodeRegistry().getFieldVisibility())
.isInstanceOf(NoIntrospectionGraphqlFieldVisibility.class);
assertThat(Introspection.isEnabledJvmWide()).isFalse();
});
}

Expand Down
2 changes: 1 addition & 1 deletion spring-boot-project/spring-boot-dependencies/build.gradle
Expand Up @@ -432,7 +432,7 @@ bom {
]
}
}
library("GraphQL Java", "21.3") {
library("GraphQL Java", "21.4") {
prohibit {
startsWith(["2018-", "2019-", "2020-", "2021-", "230521-"])
because "These are snapshots that we don't want to see"
Expand Down

0 comments on commit e3f8c34

Please sign in to comment.