swagger-api / swagger-api/swagger-ui

With multiple callbacks defined on the same URL, you can not expand one callback box

Open
#5,536 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat: rendering P2 type: bug
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: 76.0.3809.100 (Official Build) (64-bit)
  • Method of installation: online
  • Swagger-UI version: -
  • Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.0
info:
  version: 1.0.0
  title: test
  description: example with 2 callbacks
paths:
  /subscribe:
    post:
      summary: Subscribe to a webhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                callbackUrl:
                  type: string
                  format: uri
                  example: https://myserver.com/send/callback/here
              required:
                - callbackUrl
      callbacks:
        myEvent:
          '{$request.body#/callbackUrl}':
            post:
              requestBody:
                required: true
                content:
                  application/json:
                    schema:
                      type: object
                      properties:
                        message:
                          type: string
                          example: Some event happened
                      required:
                        - message
              responses:
                '200':
                  description: Your server returns this code if it accepts the callback
        otherEvent:
          '{$request.body#/callbackUrl}':
            post:
              requestBody:
                required: true
                content:
                  application/json:
                    schema:
                      type: object
                      properties:
                        id:
                          type: integer
                          format: int32
                          example: 42
                      required:
                        - id
              responses:
                '200':
                  description: Your server returns this code if it accepts the callback
      responses:
        '201':
          description: Webhook created

In this git repo: callbackMultiple.yaml

Try it online: https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jmini/openapi-experiments/master/OpenAPI-specs/callbackMultiple.yaml#/

To reproduce...

When you open the spec using Swagger-UI, you see the expected callbacks:

There are 2 box:

  • myEvent
  • otherEvent
Screenshot 2019-08-19 at 11 03 20

When you click to expand one callback "[POST] {$request.body#​/callbackUrl}" box under "myEvent", then:

Current result

Both callbacks boxes are expanded

Screenshot 2019-08-19 at 11 07 11
Expected result

Only the box that was clicked gets expanded.

This is important, especially when a lot of events are present

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 by loading the callbackMultiple.yaml example from the issue in Swagger UI and reproduce the expansion behavior for myEvent and otherEvent. Trace the callback rendering and expansion state handling, then verify that expanding one callback leaves the other collapsed.

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
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.