You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Duplicated client code if you have multiple OpenAPI schemas #2579
We've been using the generator for a while now and recently tried to upgrade to the latest version. We were blocked by the Bundle @hey-api/client-* plugins change introduced in v0.73.0.
It seems this change completely ignored the use case of having multiple OpenAPI schemas in a single application. Our application communicates with about 10 microservices, and we generate types and an SDK for each of them. Starting with v0.73.0, the generator now creates 10 copies of the client, which is bloating our bundle and is not acceptable.
I believe this should be a configurable option, similar to how JavaScript transpilers can either inline common helpers or reference them from a package.
Reacted by Kilian Finger, Upsilon-Iridani, Seth Miller and Mathias Schopmans
You're right in that we ignored that use case, because it's not something that's been explicitly supported. We'll need to come back to this, there are also people who want to use multiple clients in the same application.
I'm currently have a custom script which is using the generator programmatic api and generating schemas for separate microservices in a loop. That worked fine before, didn't feel that some additional support for that usecase is needed.
When i want to add a new service, i have to create a new folder in the src/apis/ and put a api.json file there. Than the script will go each folder in src/apis/ one be one and generate sdks.
Outputs something like that:
We did face some challenges working with this setup, for example microservices may have clashing or too broad operation IDs, such as getSelf. Get self what? it makes sense in one microservice but doesnt when consumer has many of them. So i wanted to rename it to something like getPlayerSelfState for that i implemented a simple methodNameBuilder which allowing us to rename operations with ambigous names.
Just coming here to say that issue is still here. The recent ability to specify array of schemas for the generator does not resolve the issue, because it generates one massive sdk with schemas merged. In our case we need to access multiple microservices each of them has it's own endpoint and client configuration.
Activity
mrlubos commentedon Sep 1, 2025
Hey, I think this is related to #1056
You're right in that we ignored that use case, because it's not something that's been explicitly supported. We'll need to come back to this, there are also people who want to use multiple clients in the same application.
timofei-iatsenko commentedon Sep 1, 2025
I'm currently have a custom script which is using the generator programmatic api and generating schemas for separate microservices in a loop. That worked fine before, didn't feel that some additional support for that usecase is needed.
mrlubos commentedon Sep 1, 2025
What does your output structure look like?
timofei-iatsenko commentedon Sep 1, 2025
src/apis/{name of the service}When i want to add a new service, i have to create a new folder in the
src/apis/and put aapi.jsonfile there. Than the script will go each folder insrc/apis/one be one and generate sdks.Outputs something like that:
We did face some challenges working with this setup, for example microservices may have clashing or too broad operation IDs, such as
getSelf. Get self what? it makes sense in one microservice but doesnt when consumer has many of them. So i wanted to rename it to something likegetPlayerSelfStatefor that i implemented a simplemethodNameBuilderwhich allowing us to rename operations with ambigous names.timofei-iatsenko commentedon Apr 3, 2026
Just coming here to say that issue is still here. The recent ability to specify array of schemas for the generator does not resolve the issue, because it generates one massive sdk with schemas merged. In our case we need to access multiple microservices each of them has it's own endpoint and client configuration.