question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Swagger UI overrides accept header parameter - openApi 3.0

See original GitHub issue

Q&A (please complete the following information)

  • OS: macOS
  • Browser: chrome
  • Swagger/OpenAPI version: OpenAPI 3.

Content & configuration

Swagger/OpenAPI definition:

paths:
  /v1/auth/login:
    post:
      tags:
        - admin
      summary: Login
      operationId: loginAdmin
      description: |
        Realiza o login na aplicação
      responses:
        '200':
          description: login success
        '422':
          description: 'invalid input, object invalid'
      parameters:
        - name: Content-Type
          in: header
          required: true
          schema:
            type: string
            example: application/json
            default: application/json
        - name: Accept
          in: header
          required: true
          schema:
            type: string
            example: application/json
            default: application/json

Problem:

My header when testing always converts accpet to * / * and I need to keep it fixed in application / json

Screenshots

Screen Shot 2019-08-26 at 10 06 10

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
sillekyathacommented, Jan 29, 2021

How can the same be achieved with Get requests without request body?

3reactions
osteelcommented, May 20, 2021

Same issue here. Made sure to upgrade to the latest version (3.49.0) but it still sets the accept header to */* instead of application/vnd.api+json for GET requests with no response body.

EDIT: a GET request with no response body might sound weird, but it’s because the corresponding endpoint has no request body nor response body. If I change it for a POST request instead, the issue remains the same because Swagger UI still doesn’t have a request body to determine the accept header from.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Describing Parameters - Swagger
In OpenAPI 3.0, parameters are defined in the parameters section of an operation or path. To describe a parameter, you specify its name...
Read more >
How to define accept header in Open API Specifiaction V3
In OpenAPI 3, how to document that an Accept header with a specified value is necessary on request in order for a successful...
Read more >
Using OpenAPI and Swagger UI - Quarkus
By default, Swagger UI is accessible at /q/swagger-ui . The value / is not allowed as it blocks the application from serving anything...
Read more >
F.A.Q - Springdoc-openapi
#For sorting endpoints alphabetically springdoc.swagger-ui. ... Note: Header parameters named Accept, Content-Type and Authorization are not ...
Read more >
Swagger UI - openTCS
Responses ; Code, Description, Links ; 200. Successful response · Controls Accept header. Example Value; Schema.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found