-
Notifications
You must be signed in to change notification settings - Fork 322
Description
With modern Spring, especially with Spring Boot, development of external application interfaces is very commonly declared via Java/annotation based configuration, such as Spring MVC and annotation-based WebFlux. Robust OpenAPI schema generation can be performed with Springfox.
As such, the presence of annotated controller support gave the initial impression that a familiar, Spring-like code-first approach was supported. As of https://github.com/spring-projects/spring-graphql/releases/tag/v1.0.2 that is not the case -- Spring Boot auto-configuration of GraphQL is completely disabled if GraphQL schema files are not present.
I see there has been various discussions and offered application solutions for code-first:
- Refactor GraphQlSource builder to separate programmatic vs SDL way of create GraphQLSchema #312
- Question: How to generate the schema and wiring at runtime? #452
- [Question] Code first vs schema first #511
The solutions appear to be fairly complex and indirectly derive the schema from the runtime wiring. The mechanics of constructing the runtime wiring by the AnnotatedControllerConfigurer seem more appealing since it is already traversing the surface of type-safe declarations of GraphQL integration points.
FWIW, I encountered this "limitation" during an exercise to introduce GraphQL into our product and use the exercise as an opportunity to steer the platform away from Quarkus to Spring. It turns out that Quarkus has first-class (and only) support for code-first declaration of GraphQL, which is built upon Smallrye GraphQL.