Redocly/redoc

Response example name not displayed when "examples:" section only contains one item

Open

#2.192 aberto em 20 de out. de 2022

Ver no GitHub
 (1 comment) (0 reactions) (0 assignees)TypeScript (2.272 forks)batch import
Type: Enhancementhelp wanted

Métricas do repositório

Stars
 (21.877 stars)
Métricas de merge de PR
 (Mesclagem média 3h 40m) (11 fundiu PRs em 30d)

Description

Describe the bug When an endpoint's response examples: section contains a single item, the name of that item doesn't appear above the JSON example code in the right content pane.

Expected behavior When an endpoint's response examples: section contains a single item, the name of that item appears above the JSON example code in the right content pane -- either in a dropdown box (as when the examples: section contains multiple items), or in some other fashion (e.g. label/text).

Minimal reproducible OpenAPI snippet(if possible)

paths:
  '/sites/{siteId}/users/{userId}/cart/clear':
    post:
      tags:
        - CartApi
      summary: Delete all items in a cart.
      description: <p><i>No comparable method currently exists in the monolith's codebase; this is new functionality.</i></p><p>Delete all quantities & properties of all products & services that were previously added to a shopping cart.</p>
      operationId: CartApi_DeleteAllItemsInCart
      parameters:
        - name: siteId
          in: path
          description: ID of the site to which the shopping cart is scoped.
          required: true
          schema:
            maximum: 2147483647
            minimum: 1
            type: integer
            format: int32
        - name: userId
          in: path
          description: ID of the user to whom the shopping cart is scoped.
          required: true
          schema:
            maximum: 2147483647
            minimum: 1
            type: integer
            format: int32
      responses:
        '200':
          description: <p>The API request was successfully processed; an object describing the empty cart is returned.</p>
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetCartSummaryResponse'
              examples:
                All items in the shopping cart were deleted.:
                  value: {"cartGuid":"0fa1ef5f-5395-4679-901d-fd6c941f3460","cartItems":[]}
paths:
  '/sites/{siteId}/users/{userId}/cart/clear':
    post:
      tags:
        - CartApi
      summary: Delete all items in a cart.
      description: <p><i>No comparable method currently exists in the monolith's codebase; this is new functionality.</i></p><p>Delete all quantities & properties of all products & services that were previously added to a shopping cart.</p>
      operationId: CartApi_DeleteAllItemsInCart
      parameters:
        - name: siteId
          in: path
          description: ID of the site to which the shopping cart is scoped.
          required: true
          schema:
            maximum: 2147483647
            minimum: 1
            type: integer
            format: int32
        - name: userId
          in: path
          description: ID of the user to whom the shopping cart is scoped.
          required: true
          schema:
            maximum: 2147483647
            minimum: 1
            type: integer
            format: int32
      responses:
        '200':
          description: <p>The API request was successfully processed; an object describing the empty cart is returned.</p>
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetCartSummaryResponse'
              examples:
                All items in the shopping cart were deleted.:
                  value: {"cartGuid":"0fa1ef5f-5395-4679-901d-fd6c941f3460","cartItems":[]}
                DUMMY:
                  value: {"cartGuid":"0fa1ef5f-5395-4679-901d-fd6c941f3460","cartItems":[]}

Screenshots

image

image

Additional context Add any other context about the problem here.

Guia do colaborador