Redocly / Redocly/redoc

Contents of array is not displayed within the response when using oneOf

Open
#1,638 2 comments 7 reactions 1 assignee View on GitHub

@AlexVarchuk is already working on this.

Since Jul 7, 2022.

p2 Type: Bug
Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

When a schema has an array, the contents of the array are shown in the right hand side display window when set as a response, however when oneOf is used it shows as an empty array.

openapi: "3.0.2"
info:
  title: API Title
  version: "1.0"
servers:
  - url: https://api.server.test/v1
paths:
  /test_oneof:
    get:
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/a'

  /test_without_oneof:
    get:
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/a'

components:
  schemas:
    a:
      type: array
      items:
        type: object
        properties:
          b:
            type: string

image

The details are shown in the centre panel regardless of whether oneOf is used or not.

Below shows that this is valid and displayed correctly in the swagger editor

image

(edit: added swagger editor screenshot)

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.