Schema-Driven Development involves defining API documentation as an OpenAPI schema to automatically generate server and client code, ensuring consistency and expediting development.
In Spring WebMVC/WebFlux, springdoc-openapi can generate an OpenAPI schema from Spring controller implementations, enhancing documentation and client code generation.
Defining controllers using interfaces in Spring 5.1 enables a more straightforward approach to schema-driven development with reduced complexity.
Separating controller definitions into interfaces helps in creating an API schema, facilitating OpenAPI generation and improving code review processes.
Using interfaces allows for better organization and early review of the API structure, enhancing the clarity and maintainability of the code.
The integration does not require additional tools, making it easy to implement and revert if needed, while enhancing the development experience.
The use of HTTP Interface Client in Spring 6 further extends the usability of controller interfaces for building API clients efficiently.
While the approach aligns closely with schema-driven development, it offers a practical alternative to gRPC for achieving schema-first development in Spring applications.
The combination of controller interfaces, OpenAPI schema generation, and HTTP Interface Client exemplifies an efficient and structured development approach in Spring WebMVC/WebFlux.
This methodology enhances documentation, code quality, and developer experience, providing a cohesive way to develop APIs in a schema-driven manner.