Skip to content

Same spec renders differently between this repos demo directory and a fresh install #1473

@omonk

Description

@omonk

Describe the bug

A developer raised an issue where a spec was rendering incorrectly. After debugging it I copied the same structure over to the demo repo and found that it renders as expected.

Wanting to ensure that our documentation repo wasn't the issue I created a fresh docusaurus project and added the docusaurus-plugin-openapi-docs package and recreated the setup from the docs repo

Reproduction repo - https://github.com/omonk/openapi-complex-test

Repo Working
docusaurus-plugin-openapi-docs 🟢
Test repo 🔴
My work repo 🔴

Expected behavior

The schema has a oneOf where each property is an object marked as required.

When selecting the oneOf schemas tabs, all properties should visible and remain static, the only difference is that the required flag should move between them.

Screenshots below are my custom spec rendered in the tests directory of the demo repo. Note that required flag moves between identifier and bankIdentifier

Image Image

Current behavior

With the same schema rendered in a fresh install you can see the properties are duplicated and when selecting the different tabs the top property differs. Note that identifier and bankIdentifier and duplicated in the schema

Image Image

Possible solution

Unsure

Steps to reproduce

Reproduce on this demo repo

  1. Copy complex.yam into demo/examples/tests/complex.yml
  2. yarn build && yarn clean-api-docs tests && yarn gen-api-docs tests
  3. yarn start
  4. Navigate to http://localhost:3000/tests/complex-one-of

Reproduce on provided repo

  1. Clone repo https://github.com/omonk/openapi-complex-test
  2. npm i && npm run re-gen && npm run start
  3. Navigate to http://localhost:3000/docs/complex/complex-one-of
  4. Click between tabs, see that this is different

Screenshots

See above

Context

This incorrectly renders schemas to our users

Your Environment

  • Version used: 5.0.2
  • Environment name and version (e.g. Chrome 59, node.js 5.4, python 3.7.3): Chrome 148, node 24.14.1
  • Operating System and version (desktop or mobile): macOS
  • Link to your project: https://github.com/omonk/openapi-complex-test

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions