docusaurus-openapi-docs icon indicating copy to clipboard operation
docusaurus-openapi-docs copied to clipboard

"can't access property "readOnly", mergedSchemas is undefined" while opening a generated page

Open Paolo7297 opened this issue 4 months ago • 1 comments

Describe the bug

When using a specific OpenAPI schema, Selecting a specific operation shows:

This page crashed.

can't access property "readOnly", mergedSchemas is undefined

The OpenAPI operation which triggers the issue is

The OpenAPI snippet
            "post": {
                "operationId": "api_invoices_post_collection",
                "tags": [
                    "Invoice"
                ],
                "responses": {
                    "400": {
                        "description": "Invalid input"
                    },
                    "202": {
                        "description": "Invoice resource created",
                        "content": {
                            "application/ld+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Invoice.InvoiceOutput.jsonld-read"
                                }
                            },
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Invoice.InvoiceOutput-read"
                                }
                            },
                            "text/html": {
                                "schema": {
                                    "$ref": "#/components/schemas/Invoice.InvoiceOutput-read"
                                }
                            },
                            "application/xml": {
                                "schema": {
                                    "$ref": "#/components/schemas/Invoice.InvoiceOutput-read"
                                }
                            },
                            "text/xml": {
                                "schema": {
                                    "$ref": "#/components/schemas/Invoice.InvoiceOutput-read"
                                }
                            },
                            "application/octet-stream": {
                                "schema": {
                                    "$ref": "#/components/schemas/Invoice.InvoiceOutput-read"
                                }
                            },
                            "application/pdf": {
                                "schema": {
                                    "$ref": "#/components/schemas/Invoice.InvoiceOutput-read"
                                }
                            },
                            "application/zip": {
                                "schema": {
                                    "$ref": "#/components/schemas/Invoice.InvoiceOutput-read"
                                }
                            },
                            "text/csv": {
                                "schema": {
                                    "$ref": "#/components/schemas/Invoice.InvoiceOutput-read"
                                }
                            }
                        },
                        "links": {}
                    },
                    "422": {
                        "description": "Unprocessable entity"
                    }
                },
                "summary": "Creates a Invoice resource.",
                "description": "Create a new invoice and send it to the government channel",
                "parameters": [],
                "requestBody": {
                    "description": "The new Invoice resource",
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Invoice.InvoiceInput-write"
                            }
                        },
                        "application/xml": {
                            "schema": {
                                "$ref": "#/components/schemas/Invoice.InvoiceInput-write"
                            }
                        },
                        "text/xml": {
                            "schema": {
                                "$ref": "#/components/schemas/Invoice.InvoiceInput-write"
                            }
                        }
                    },
                    "required": true
                },
                "deprecated": false
            }

during the api pages generation it shows:

Could not merge values, they are probably incompatible
WARNING: failed to create example from schema object: TypeError: Cannot read properties of undefined (reading 'oneOf')
Could not merge values, they are probably incompatible
Could not merge values, they are probably incompatible
Could not merge values, they are probably incompatible
Could not merge values, they are probably incompatible
Could not merge values, they are probably incompatible
Could not merge values, they are probably incompatible
WARNING: failed to create example from schema object: TypeError: Cannot read properties of undefined (reading 'oneOf')
Could not merge values, they are probably incompatible
Could not merge values, they are probably incompatible
Could not merge values, they are probably incompatible
Could not merge values, they are probably incompatible

I don't know if it matters.

I'm attaching the generated page with the issue.

api-invoices-post-collection.api.zip

Expected behavior

Shows the operation like the others

Current behavior

Gives me the error reported above

Steps to reproduce

  1. Configure this plugin to use this OpenAPI spec
          govit: {
            specPath: "./static/openapi/gov-it-api.json",
            outputDir: "docs/api/gov-it",
            sidebarOptions: {
              groupPathsBy: "tag",
              sidebarCollapsed: true,
            },
          } satisfies OpenApiPlugin.Options,
  1. Generate pages
  2. Start docusaurus
  3. Open the generated page /docs/api/gov-it/api-invoices-post-collection
  4. Page crashes

Screenshots

Image

Context

Add api docs of this project

Your Environment

  • Version used: Docusaurus 3.8.1 | docusaurus-openapi-docs 4.5.1
  • Environment name and version: Node v24.8.0, zen-browser 1.16b and google-chrome 140.0.7339.185
  • Operating System and version (desktop or mobile): Arch
  • Link to your project: We don't have one yet

Paolo7297 avatar Sep 25 '25 11:09 Paolo7297