swagger-api / swagger-api/swagger-codegen
[HTML2] multiple examples not showing
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When defining examples for multiple responses in YAML file, they are not displayed correctly in the page. The HTML is there, but the "Response Example" link only links to the first one
paths:
/listAccount:
get:
description: |-
Lists accounts
operationId: listAccount
parameters:
- name: inputs
in: body
description: json input
required: true
schema:
$ref: "#/definitions/Request"
responses:
'200':
description: Success
schema:
$ref: '#/definitions/Response'
examples:
application/json: |
{"foo1": "bar1"
}
'500':
description: Error
schema:
$ref: '#/definitions/ErrorResponse'
examples:
application/json: |
{"foo2": "bar2"
}
HTML output issue:
Response Example
Response Example
Same anchor link for both
Same id of div for both sections:
So the anchor will always go to the first one in the doc.
Does this need splitting out somehow?
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 reproducing the issue with the YAML definition shown and inspect the generated HTML response-example links and tab-pane ids. Done means each response example has a distinct anchor and corresponding section id, so each link opens its own example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, openapi
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100