Swagger open API spec
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Swagger open API spec
Hello all,
I have an API I've defined with swagger that has a custom JWT format. I'd like to tell my API clients what the format is so that they can include it in an HTTP header. I can do this manually in the API description tag. Example:
JWT format
Header
{
"alg": "HS256",
"typ:" "JWT"
}
Payload
{
"myPayload": "MyData"
}
But in order to be formatted this way, I need to describe it like this: <p> JWT format<p> Header<br>{<br> "alg": "HS256", <br> "typ": "JWT"<br>}<br>Payload<br>{ <br> "myPayload": "my data"<br>}
Is there a better way that uses the proper swagger/yaml tags to do this? I know of the security schema tags but these don't let me describe my JWT format very well.
- Labels:
-
Swagger Editor
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey @NickDotIo. As you pointed out, there is native support in the OpenAPI syntax for describing JWTs: https://swagger.io/docs/specification/authentication/bearer-authentication/
Is there a reason you cant use this approach?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
