Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth API for external-facing SDKs #1685

Open
jboolean opened this issue Feb 7, 2025 · 1 comment
Open

Auth API for external-facing SDKs #1685

jboolean opened this issue Feb 7, 2025 · 1 comment
Labels
feature 🚀 New feature or request
Milestone

Comments

@jboolean
Copy link

jboolean commented Feb 7, 2025

I've been trying to build an api library package with openapi-ts. It seems like the SDK exports all the api methods as top-level functions, rather than the ability to create a client instance of a class with your auth token as other generators do, and as is a common pattern.

The docs say you can set the auth token once by manipulating the client directly. But the client is not exported on index.ts, so consumers of my package would not be able to do this. Are they expected to pass auth on every request? This seems to create a poor experience for consumers of the generated library.

Would love some option on the SDK to be more like openapi-typescript-codegen where it can generate a client with a custom name. Or, at least clarify the docs so I can understand how the consumer is supposed to be able to modify the client.

@mrlubos
Copy link
Member

mrlubos commented Feb 7, 2025

Hi @jboolean, this use case isn't supported well today as you found out. Are you able to link me to your API? I assume it's publicly available? I'd be happy to work on this with you, it just hasn't been prioritised as most people use this package for internal development

@mrlubos mrlubos added the feature 🚀 New feature or request label Feb 10, 2025
@mrlubos mrlubos changed the title So how is the consumer supposed to add auth to a client if it's not exported? Auth API for external-facing SDKs Feb 10, 2025
@mrlubos mrlubos added this to the Parser milestone Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🚀 New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants