-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
Support bearerFormat option in security schemes #1848
Comments
I'd need to see what you're doing but I'm afraid you might be trying to execute a custom client which is not currently supported. Why not modify the existing client package? You only need to build it and then add a new test in openapi-ts for that client. You should be able to see how the other supported schemes are tested and do something similar. Happy to chat more if you need guidance |
Here's a similar test for OpenAPI 3.1 for example https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/test/3.1.x.test.ts#L515-L528 |
I was indeed modifying the existing client package, in But I'll take a look at the tests and see about doing it that way. I guess I don't actually have to run the generator and examine the generated code; I just need to write a test for it and verify it works? |
I always inspect the generated snapshot to verify it's doing what I want. There are a few parts to this feature:
Feel free to open a draft if you get stuck on anything and I can point you to the relevant parts. |
In terms of building, I'm not sure if I have the dependencies configured with Turborepo, but basically if you modify the core package, it needs to be built, then the client needs to be built, and finally openapi-ts. That's how you get the core package change to the generated output. |
Ok, I think #1849 is what we're looking for here? Please let me know what you think... |
Let's take a step back on this actually. What's your source for this information? The spec says the following:
It sounds like we have a different understanding here. I guess you're trying to implement a custom format? |
Ah wow, yes, I completely misunderstood what Although, I guess the docs for
... which I suppose means you can put anything for Anyhow, sorry for the noise, I'll close this issue and the PR. have another one coming that adds |
Yeah. I guess the question is if this is a requirement for you? How are you generating your spec? If your API requires custom auth, let's get this done. I was going to suggest using |
My API doesn't require it, no. I'm designing something new, so I can do it however I'd like, and this method (at first glance) seemed simple and reasonable. But after this discussion, I feel like it's a bit of an "abuse" of the Authorization header, so I'm fine implementing it in a different way. |
Description
For the
http
security scheme, with typebearer
, there is an optional propertybearerFormat
that specifies the token that goes first in theAuthorization
header. This defaults toBearer
, but openapi-ts doesn't support setting this to something else.I started work to add support for this, but I'm having trouble figuring out how to test my changes. How can I run openap-ts, pointing it at my local copy of
client-fetch
? I've tried passing the full path to the package in the--client
option, as well as installing my local copy ofclient-fetch
intonode_modules
and just specifying--client client-fetch
, but neither worked.The text was updated successfully, but these errors were encountered: