Skip to content

[Bug] Object-level extensions missing when requestBody is an array of objects #2723

@nabedge

Description

@nabedge

When the requestBody is an array of objects, the extension information specified at the object level is not displayed.

% cat openapi/openapi.yaml

openapi: 3.0.4
info:
  title: Article Posting API
  description: redoc issue sample. Attention to "x-cross-validation" extension !
  version: 1.0.0
servers:
  - url: http://localhost:8080
    description: development
paths:
  /article:
    post:
      summary: create one article
      requestBody:
        content:
          application/json:
            schema:
              title: ArticlePostRequest
              type: object
              properties:
                article:
                  $ref: '#/components/schemas/Article'
      responses:
        '200':
          description: 'OK'
          content:
            application/json:
              schema:
                title: ArticleResponse
                type: object
                properties:
                  article:
                    $ref: '#/components/schemas/Article'

  /articles/bulk:
    post:
      summary: create articles
      requestBody:
        content:
          application/json:
            schema:
              title: BulkArticles
              type: object
              properties:
                articles:
                  type: array
                  items:
                    $ref: '#/components/schemas/Article'
                  x-check-list-min:
                    value: 1
                  x-check-list-max:
                    value: 100
      responses:
        '200':
          description: 'OK'
          content:
            application/json:
              schema:
                title: BulkArticlesResponse
                type: object
                properties:
                  articles:
                    type: array
                    items:
                      $ref: '#/components/schemas/Article'

components:
  schemas:
    Article:
      title: Article
      type: object
      properties:
        title:
          type: string
        author:
          type: string
        sentence:
          type: string
        publishDate:
          type: string
          x-check-date-format:
            value: yyyyMMdd
        endDate:
          type: string
          x-check-date-format:
            value: yyyyMMdd
      x-cross-validation:
        - expression: publishDate < endDate
        - expression: publishDate = null
          condition:
            - endDate = null
        - expression: endDate = null
          condition:
            - publishDate = null

% npx @redocly/[email protected] build-docs \
  ./openapi/openapi.yaml \
  -o ./target/index.html \
  --theme.openapi.showExtensions=true

% open ./target/index.html 
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions