PaloAltoNetworks / PaloAltoNetworks/docusaurus-openapi-docs

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

Open
#1,473 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.1k
Forks
315
Avg merge
7d 5h
Merged PRs (30d)
7

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by copying complex.yml into demo/examples/tests/complex.yml and running the documented build, clean-api-docs, and gen-api-docs commands. Compare the generated page at /tests/complex-one-of with the fresh project at /docs/complex/complex-one-of while switching oneOf tabs. Done means the properties are not duplicated and only the required flag changes between tabs.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, react, typescript
Domain
documentation, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.