spring-boot-openapi-generics-clients — Production-Ready, Type-Safe API Clients with Generics #1
Replies: 2 comments
-
|
Is this solution fully compliant with OAS 3.1.1 specs OAI/OpenAPI-Specification#3601. Had a hard time making this work end to end. I.e generate openapi spec from controller -> use that in the client code. |
Beta Was this translation helpful? Give feedback.
-
|
Hi! Thanks for digging into this — getting “controller → spec → client” to work end-to-end with generic envelopes is still surprisingly tricky. On the compliance side: the approach in this repo is OAS 3.1.x compatible, because the generated schemas remain valid OpenAPI/JSON Schema. However, it does not use So you can think of it as a practical compatibility layer:
In other words, you’re right about the “intent”: many toolchains assume a manually-augmented spec. What this project aims to do is make that augmentation happen automatically during spec generation, so the client can stay fully aligned without manual edits. If/when the ecosystem supports |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
💭 How are you using generics-aware OpenAPI clients in your stack?
Hi everyone 👋
I’m curious how others are approaching generics-aware client generation.
This repository — spring-boot-openapi-generics-clients — demonstrates one production-ready implementation, but I’d love to hear how you are adapting similar concepts in your own projects:
{ data, meta }response envelope pattern💭 Have you tried using generics or unified envelopes in your APIs?
Share your approach — even a short note helps others discover new patterns and trade-offs.
🚀 What this project provides
ServiceResponse<T>andServiceClientResponse<T>as reusable generic bases🖼 Demo & Docs
Check the repository for:
Swagger UI screenshots of the enhanced OpenAPI schema
Examples of generated client classes — before vs after generics overlay
Detailed adoption guides for both sides of the architecture:
📖 Background
This work began with my Medium article:
👉 We Made OpenAPI Generator Think in Generics
It has since evolved into a full reference project — complete with documentation, templates, and examples that demonstrate how to make OpenAPI Generator truly generics-aware.
💬 I’d love to hear your feedback, questions, or real-world insights.
Drop a comment below — even a few words help others explore and refine this approach.
Beta Was this translation helpful? Give feedback.
All reactions