Skip to content

Request Body Schemas Using allOf/oneOf/$ref Not Rendered in UI #1241

@vsnreddy10

Description

@vsnreddy10

Describe the bug

Request body schemas that use allOf/oneOf/$ref composition are not rendered in the generated documentation. The request body section appears empty or incomplete when using the Docusaurus OpenAPI plugin, even though the OpenAPI spec is valid and renders correctly in Swagger UI.

Expected behavior

The plugin should resolve and display all properties from composed schemas (using allOf, oneOf, and $ref) in the request body section, similar to how Swagger UI flattens and renders them.

Current behavior

The request body section is missing or does not show the merged properties when the schema uses allOf/oneOf/$ref. Only the schema name or a partial structure is shown, making it unclear to users what fields are required.

Possible solution

Enhance the plugin to fully resolve and flatten composed schemas (allOf, oneOf, $ref) for request bodies, so all properties are displayed in the documentation.

Steps to reproduce

  1. Create an OpenAPI spec with a request body schema using allOf/oneOf/$ref (see example below).
  2. Add the spec to a Docusaurus site using the OpenAPI plugin.
  3. Build or serve the docs.
  4. Navigate to the endpoint with the composed request body schema and observe the missing or incomplete schema rendering.

Screenshots

Context

This affects our ability to document APIs with reusable and composed schemas. Consumers of our API docs cannot see the required fields for endpoints with composed request body schemas, leading to confusion and support overhead.

example:

requestBody:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/UploadRequest'
- $ref: '#/components/schemas/UploadTemplateRequest'
components:
schemas:
UploadRequest:
allOf:
- $ref: '#/components/schemas/UploadRequestTemplate'
- type: object
required: [contentType]
properties:
contentType:

Image
          $ref: '#/components/schemas/ContentType'
UploadRequestTemplate:
  type: object
  required: [content, notificationChannel, subject, templateName]
  properties:
    notificationChannel:
      $ref: '#/components/schemas/NotificationChannel'
    templateName:
      type: string
    subject:
      type: string
    content:
      type: string

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