Show HN: Spring Boot and OpenAPI Generator – type-safe clients with generics
I built a demo Spring Boot 3.4 microservice + OpenAPI 3.1 project that shows how to solve this with:
• A small Springdoc OpenApiCustomizer that tags wrapper schemas with vendor extensions • A tiny Mustache template override that generates thin shells extending a reusable generic base • Full CRUD example (create, get, update, delete) with type-safe client code • Integration tests using MockWebServer • HttpClient5 support for connection pooling and timeouts
Result: instead of dozens of duplicated wrappers, the generator emits a single reusable `ServiceClientResponse<T>` base + thin endpoint-specific shells. Client code stays clean, type-safe, and much easier to maintain.
GitHub repo (demo code): https://github.com/bsayli/spring-boot-openapi-generics-clien...
Detailed write-up (Medium article): https://medium.com/@baris.sayli/type-safe-generic-api-respon...
Would love feedback from the HN community
No comments yet