Closed billycrid closed 3 months ago
Hi @billycrid, I believe that oneOf
requires at least one schema to be defined for it to be valid. In your example, I only see the required
property which isn't a schema. when I provide a valid schema it works as expected.
Yeah fair point @sserrata - question though, is there anyway to handle invalid schemas then? Maybe throw an error during generate phase rather than build phase? Or least have some sort of catching for scenarios that could end up rendering Tabs without any TabItems?
Hi @billycrid, although the plugin does perform some safety/type checking while parsing, it's not a full blown OpenAPI linter. That said, we could potentially try to catch/handle scenarios where <SchemaTabs>
would have no children
FWIW, I use the spectral extension in vscode for linting but your case appears to go undetected since the use of required
satisfies the linter rule which appears to only look for an array value, not necessarily a schema or schemas.
Describe the bug
Given the following dependencies
And with an openapi.yaml configuration of:
After running
npm run gen-api-docs
on this file, the output will compile correctly. However, after then runningnpm run build
, the process will error with:Looking at the outputted files i can see its rendered a
<SchemaTabs></SchemaTabs
- manually removing this the passes the build. But i feel this should either not be generated by the openapi-docs library or it should be generated with at least one tab to ensure it doesn't fail.Expected behavior
gen-api-docs
should either not generate SchemaTabs that are empty, or should add at least one item into it so it doesn't impact the build.Current behavior
gen-api-docs
generates empty SchemaTabs, thus blocking the build process.Possible solution
gen-api-docs
should either not generate SchemaTabs that are empty, or should add at least one item into it so it doesn't impact the build.Steps to reproduce
provided above
Your Environment
[INFO] Docusaurus version: 3.4.0 Node version: v20.15.1