Skip to content

When properties and allOf are used in an array item, it doesn’t work correctly. #1153

@dsuket

Description

@dsuket

Describe the bug

Shcema:

type: array
items:
  $ref: '#/components/schemas/Book'

Schema Components:

BookBase:
  type: object
  required:
    - id
    - title
    - author
  properties:
    id:
      type: integer
      format: int64
      description: Unique identifier for the book
    title:
      type: string
      description: The title of the book
    author:
      type: string
      description: The author of the book

AdditionalBookInfo:
  type: object
  properties:
    publishedDate:
      type: string
      format: date
      description: The date the book was published
    genre:
      type: string
      description: The genre of the book
    tags:
      type: array
      items:
        type: string
      description: Tags associated with the book

Book:
  allOf:
    - $ref: '#/components/schemas/BookBase'
    - $ref: '#/components/schemas/AdditionalBookInfo'
  properties:
    category:
      type: string
      description: The category of the book

As shown above, when an object with allOf and properties is used as an item in an array, the properties defined in allOf are not displayed.

Expected behavior

Everything defined with allOf and properties is displayed.

Current behavior

Image
Only the contents defined in properties are displayed, while the ones specified in allOf are not shown.

Possible solution

I'm not sure of the solution.

Steps to reproduce

  1. In the OpenAPI Spec, define an object that has both allOf and properties, and use it as an item in an array.
  2. Generate the API reference.
  3. Open the relevant endpoint in the browser.

Screenshots

Context

Your Environment

  • Version used: v4.4.0
  • Environment name and version (e.g. Chrome 59, node.js 5.4, python 3.7.3):
  • Operating System and version (desktop or mobile): both
  • Link to your project:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions