openapi-generics — 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 handling generics‑aware OpenAPI clients in production?
Hi everyone 👋
This repository has evolved into a contract‑first, generics‑aware OpenAPI platform.
It is no longer a sample project — it is a deterministic architecture for producing and consuming APIs where:
🧠 Core Idea
At the center of the system is a shared canonical contract:
This module defines:
ServiceResponse<T>— unified success envelopePage<T>,Meta,Sort— pagination primitivesThis contract is:
OpenAPI is treated as a deterministic projection layer, not the source of truth.
⚙️ Platform Structure
The system is built as a platform with clear boundaries:
Server entry point
Client entry point
🧩 What problem does this solve?
Typical OpenAPI setups with
{ data, meta }envelopes break down when generics are introduced:This platform ensures:
ServiceResponse<T>)ServiceResponse<Page<T>>)🏗 What the platform provides
Contract module (
openapi-generics-contract)Server starter (
openapi-generics-server-starter)Generator layer (
openapi-generics-java-codegen)Parent distribution (
openapi-generics-java-codegen-parent)🔁 Key principle
This avoids:
🤔 Discussion prompts
I’d love to hear how others approach this in real systems:
Even short notes or trade‑offs are valuable.
📦 Repository
👉 https://github.com/blueprint-platform/openapi-generics
📖 Background
This work started from an exploration of generics-aware client generation and evolved into a platform-level architecture where:
💬 If you're building or evaluating generics‑aware API systems, your perspective is highly valuable.
What worked, what failed, and what constraints did you hit?
Let’s surface real-world patterns — not just ideal ones.
Beta Was this translation helpful? Give feedback.
All reactions