Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Incompatibility between DGS 10.0.1 and Spring-GraphQL’s SchemaMappingInspector in Mvc-Tests #2097

Open
colomdan opened this issue Dec 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@colomdan
Copy link

colomdan commented Dec 24, 2024

In DGS 10.0.1, we are now running tests with @EnableDgsMockMvcTest.
In these tests, DGS validates our schema using the SchemaMappingInspector from spring-graphql.
This inspector does not allow the same patterns for Java Beans as DGS does. Boolean flags cannot be resolved the following way.

allowed: Boolean!

public Boolean isAllowed() {
    return this.isAllowed;
  }

When I just start the Application everything works without any Issues. It seems the SchemaMappingInspector is only used in Mvc-Tests?

Expected behavior

A schema that works without issues in DGS should also be correctly validated by spring-graphql within tests. Or there should be an option to disable the SchemaMappingInspector in Tests.

Actual behavior

I get the following Exception when I start the test.

Caused by: java.lang.IllegalArgumentException: Method must not be null
	at org.springframework.util.Assert.notNull(Assert.java:172)
	at org.springframework.core.MethodParameter.<init>(MethodParameter.java:128)
	at org.springframework.core.MethodParameter.<init>(MethodParameter.java:114)
	at org.springframework.graphql.execution.SchemaMappingInspector.checkFieldsContainer(SchemaMappingInspector.java:184)
	at org.springframework.graphql.execution.SchemaMappingInspector.checkField(SchemaMappingInspector.java:254)
	at org.springframework.graphql.execution.SchemaMappingInspector.checkFieldsContainer(SchemaMappingInspector.java:185)
	at org.springframework.graphql.execution.SchemaMappingInspector.checkField(SchemaMappingInspector.java:254)
	at org.springframework.graphql.execution.SchemaMappingInspector.checkFieldsContainer(SchemaMappingInspector.java:173)
	at org.springframework.graphql.execution.SchemaMappingInspector.checkField(SchemaMappingInspector.java:254)
	at org.springframework.graphql.execution.SchemaMappingInspector.checkFieldsContainer(SchemaMappingInspector.java:185)
	at org.springframework.graphql.execution.SchemaMappingInspector.checkField(SchemaMappingInspector.java:254)
	at org.springframework.graphql.execution.SchemaMappingInspector.checkFieldsContainer(SchemaMappingInspector.java:173)
	at org.springframework.graphql.execution.SchemaMappingInspector.checkField(SchemaMappingInspector.java:254)
	at org.springframework.graphql.execution.SchemaMappingInspector.checkFieldsContainer(SchemaMappingInspector.java:173)
	at org.springframework.graphql.execution.SchemaMappingInspector.checkSchemaFields(SchemaMappingInspector.java:139)
	at org.springframework.graphql.execution.SchemaMappingInspector.getOrCreateReport(SchemaMappingInspector.java:130)
	at org.springframework.graphql.execution.SchemaMappingInspector$DefaultInitializer.inspect(SchemaMappingInspector.java:447)
	at org.springframework.graphql.execution.SchemaMappingInspector.inspect(SchemaMappingInspector.java:317)
	at com.netflix.graphql.dgs.springgraphql.DgsGraphQLSourceBuilder.setupSchemaReporter$lambda$2(DgsGraphQLSourceBuilder.kt:152)
@colomdan colomdan added the bug Something isn't working label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant