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
I'm using Orval inside a Turborepo, and it's working great to generate typed API functions from my OpenAPI spec.
The problem I'm running into is that the generated functions are just plain functions, which means I have to import and call them directly everywhere. What I’d really like is to have a generated API client (e.g. apiClient) that wraps those functions, so that each consumer of the package can:
Initialize a client once, providing options like baseUrl and headers (for things like auth tokens).
Use the generated client to access all endpoints in a consistent way, for example:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Orval inside a Turborepo, and it's working great to generate typed API functions from my OpenAPI spec.
The problem I'm running into is that the generated functions are just plain functions, which means I have to import and call them directly everywhere. What I’d really like is to have a generated API client (e.g. apiClient) that wraps those functions, so that each consumer of the package can:
Initialize a client once, providing options like baseUrl and headers (for things like auth tokens).
Use the generated client to access all endpoints in a consistent way, for example:
instead of
Is there currently a way to do this with Orval?
If not, would it make sense as a feature request? I think it could really improve DX, especially in monorepo setups.
Beta Was this translation helpful? Give feedback.
All reactions