swagger-api / swagger-api/swagger-ui

UI renders the "Response content type" Drop down for operations with no produces

Open
#3,532 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat: try-it-out type: enhancement
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

For the OpenAPI 2.0 document below, Swagger UI renders the Response content type drop down and tries to pass an Accept header even though the DELETE operation does not have a produces: value

swagger: "2.0"
info:
  version: "1"
  title: Delete prompts for Accept media type
  description: Delete prompts for Accept media type
basePath: /delete-accept
schemes:
- "http"
paths:
  /models/{modleId}:
    delete:
      summary: Delete a model
      description: "Even though this operation does not produce anything,
        Swagger UI still prompts for and passes the Accept: header"
      operationId: deleteModel
      parameters:
      - name: modelId
        in: path
        required: true
        type: string
        description: The ID of the model to delete
      responses:
        204:
          description: No Content. The model was deleted.
        404:
          description: Not Found

Try it out -> execute shows the command:

curl -X DELETE "http://localhost/delete-accept/models/{modleId}" -H "accept: application/json"

The screenshot shows the rendering
delete-accept

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

Reproduce the issue in Swagger UI with the provided OpenAPI 2.0 document and inspect the response content type control and generated request. Done means a DELETE operation without a produces value has no Response content type dropdown and does not send an Accept header; verify the generated curl command.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.