swagger-api / swagger-api/swagger-ui
Authorization header not included in UI docs when using securitySchemes
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A (please complete the following information)
- OS: macOS
- Browser: Chrome
- Version: 75.0.3770.100
- Method of installation: accessed via SwaggerHub
- Swagger-UI version: unknown
- Swagger/OpenAPI version: 3.0.0
Content & configuration
Example Swagger/OpenAPI definition:
openapi: 3.0.0
info:
version: '1.0.0'
title: ''
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
security:
- bearerAuth: []
paths:
/logout:
summary: Log out request endpoint
post:
responses:
'200':
description:
'OK'
Describe the bug you're encountering
To reproduce...
Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior
I was hoping that the use of securitySchemes above would still show that an Authorization header is required for all requests to which scheme: bearer is applied. Unfortunately this is not the case on SwaggerHub (which I assume uses SwaggerUI, but please correct me if not), where I see a padlock button that can be used to configure the auth header but no explicit textual representation.
Screenshots
Here's what I see:
Here's what I'd want to see - output as if I'd manually defined the header on each request manually, using something like:
parameters:
- in: header
name: Authorization
schema:
type: string
description: The JWT token
required: true
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by loading the supplied OpenAPI 3.0 example in Swagger UI or SwaggerHub and compare the displayed operation details with the expected Authorization header representation. Done means bearer security requirements are explicitly represented in the UI for affected requests, rather than only through the padlock control.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- documentation, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100