Skip to content

Unable to render example from schema when using anyOf or other multiple responses #946

@tjperry07

Description

@tjperry07

Describe the bug

I noticed that it can't render the example from the schema when using anyof. It does know that there are two possible responses, but not what the schema is. I do know each one is correct because they are being used elsewhere and that renders.

      "EnvironmentsResponse": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "description": "A collection of environment information.",
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Environment"
                }
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EnvironmentSummary"
                }
              }
            ]
          }
        }
      },

Expected behavior

It should render each response.

Current behavior

Doesn't render each response. Instead returns

{
  "data": [
    null
  ]
}

Possible solution

Steps to reproduce

https://preview-docs.coalesce.io/docs/api/coalesce/get-environments (no schema example)
https://preview-docs.coalesce.io/docs/api/coalesce/get-environment (Schema example working)

They both share the Environment Component.

Every endpoint that has multiple responses doesn't render an example.
List Nodes
Get Node
List Workspace Nodes

It does work in Swagger Editor.

Screenshot 2024-09-05 at 3 54 06 PM

Context

Not able to provide response examples when there are multiple options.

Your Environment

    "@docusaurus/core": "^3.5.2",
    "@docusaurus/preset-classic": "^3.5.2",
    "docusaurus-plugin-openapi-docs": "^4.0.1",
    "docusaurus-theme-openapi-docs": "^4.0.1",

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