swagger-api / swagger-api/swagger-ui

Authorization (lock symbol) is rendered incorrectly

Open
#4,402 32 comments 66 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat: style & presentation cat: user experience needs: UX/design input type: discussion type: enhancement
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

I have endpoints that either have a required authorization or an optional authorization (see example).
I think the lock symbols are rendered incorrectly. It shows a black locked symbol for optional authorization (/public) and and a gray unlocked symbol for required authorization (/private).

Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? 3.0.0 and 2.0
Which Swagger-UI version? 3.x currently used by hosted Swagger Editor + master branch (03.04.2018 15:36)
How did you install Swagger-UI? Hosted Swagger Editor + locally using master branch (03.04.2018 15:36)
Which browser & version? Chrome 65.0.3325.181
Which operating system? Windows 10
Demonstration API definition
openapi: 3.0.0
servers:
  - url: 'https://localhost/api/'
info:
  title: OpenEO API
  version: 0.3.0
paths:
  /public:
    get:
      summary: This endpoint allows users to access it with AND without authentication.
      security:
        - {}
        - Bearer: []
      responses:
        '200':
          description: ...
  /private:
    get:
      summary: This endpoint allows users to access it only with authentication.
      security:
        - Bearer: []
      responses:
        '200':
          description: ...
components:
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
Expected Behavior

It shows a gray unlocked symbol for optional authorization (/public) and and a black locked symbol for required authorization (/private).

Current Behavior

It shows a black locked symbol for optional authorization (/public) and and a gray unlocked symbol for required authorization (/private).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied OpenAPI 3.0 example and trace how Swagger UI renders authorization symbols for operations with optional versus required security. Check the equivalent Swagger 2.0 behavior and identify the existing authorization rendering entry point or tests. Done means optional authorization shows a gray unlocked symbol and required authorization shows a black locked symbol for both formats.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.