You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If my configured versions in the docusaurus-plugin-openapi-docs plugin instance specify an outputDir that does not contain the path value from the @docusaurus/plugin-content-docs plugin instance, then gen-api-docs:version will fail to build.
Expected behavior
For the docusaurus-plugin-openapi-docs plugin to generate the versioned MDX files at whatever location I have configured. Even if it's outside the docs path.
Current behavior
I think the docusaurus-plugin-openapi-docs plugin assumes that the outputDir for a given version will always be contained within the path value for the docs plugin.
Trying to generate the versioned MDX files like yarn docusaurus gen-api-docs:version -p ap-apis ap_platform:2.8.4 results in an error similar to:
[ERROR] TypeError: Cannot read properties of undefined (reading 'replace')
at /Users/elliotvoris/Dev/docs/stellar/node_modules/docusaurus-plugin-openapi-docs/lib/index.js:256:30
at Array.map (<anonymous>)
at generateApiDocs (/Users/elliotvoris/Dev/docs/stellar/node_modules/docusaurus-plugin-openapi-docs/lib/index.js:225:17)
at async Command.<anonymous> (/Users/elliotvoris/Dev/docs/stellar/node_modules/docusaurus-plugin-openapi-docs/lib/index.js:535:11)
(Note: those line numbers are probably wrong, I had added some console.log() statements in that file for troubleshooting)
Possible solution
One possible fix might be as simple as modifying the plugin's index.ts file like this:
If that's a fitting fix, I'm more than happy to create a PR for it. (Here's a patch I'm using temporarily to fix it and it's working pretty well I think [ignore the other stuff in the patch file, that's an unrelated issue that I'll someday make a PR for lol])
Steps to reproduce
Here's the steps I remember doing:
Create a new version with the docusaurus docs plugin using yarn docusaurus docs:version:ap 2.8.4 (ap is the id of the docs plugin instance)
Add versions to the openapi plugin so it can re-generate the "old" versions when required. Including the plugin-content-docs instance here, for (hopefully) added clarity.
Attempt to change and re-generate the MDX files with yarn docusaurus gen-api-docs:version -p ap-apis ap_platform:2.8.4
Error as described above.
Context
My use-case is a little complicated here, and likely atypical. We're configuring a new instance of @docusaurus/plugin-content-docs (there are others) to work with a new instance of docusaurus-plugin-openapi-docs (there are also others). We want to setup versioning for just a specific part of our docs site, hence the multi-instance stuff.
We want to version all of the docs that are managed by this @docusaurus/plugin-content-docs instance. So, I've used the "regular" docusaurus method to make a new version. When configuring the docusaurus-plugin-openapi-docs instance, I'm adding versions so that I could update the "old" versions if it ever becomes necessary.
Maybe this isn't the "best" or "typical" way of accomplishing this? Essentially we're looking to version everything under a /certain/url/path without versioning anything else. Is there already any established precedent for this kind of use-case?
Hi @ElliotFriend, this is expected behavior as the path is derived by docsPluginId at the root/parent level, meaning it's designed to be "inherited" by versions.
Have you considered/tried separating versions into their own docusaurus-plugin-openapi-docs instances?
Note that I've not thoroughly tested multi plugin instances so I make no guarantees it will work 😅
Describe the bug
If my configured versions in the
docusaurus-plugin-openapi-docs
plugin instance specify anoutputDir
that does not contain thepath
value from the@docusaurus/plugin-content-docs
plugin instance, thengen-api-docs:version
will fail to build.Expected behavior
For the
docusaurus-plugin-openapi-docs
plugin to generate the versioned MDX files at whatever location I have configured. Even if it's outside the docs path.Current behavior
I think the
docusaurus-plugin-openapi-docs
plugin assumes that the outputDir for a given version will always be contained within thepath
value for the docs plugin.Trying to generate the versioned MDX files like
yarn docusaurus gen-api-docs:version -p ap-apis ap_platform:2.8.4
results in an error similar to:(Note: those line numbers are probably wrong, I had added some
console.log()
statements in that file for troubleshooting)Possible solution
One possible fix might be as simple as modifying the plugin's
index.ts
file like this:If that's a fitting fix, I'm more than happy to create a PR for it. (Here's a patch I'm using temporarily to fix it and it's working pretty well I think [ignore the other stuff in the patch file, that's an unrelated issue that I'll someday make a PR for lol])
Steps to reproduce
Here's the steps I remember doing:
Create a new version with the docusaurus docs plugin using
yarn docusaurus docs:version:ap 2.8.4
(ap
is the id of the docs plugin instance)Add versions to the openapi plugin so it can re-generate the "old" versions when required. Including the
plugin-content-docs
instance here, for (hopefully) added clarity.yarn docusaurus gen-api-docs:version -p ap-apis ap_platform:2.8.4
Context
My use-case is a little complicated here, and likely atypical. We're configuring a new instance of
@docusaurus/plugin-content-docs
(there are others) to work with a new instance ofdocusaurus-plugin-openapi-docs
(there are also others). We want to setup versioning for just a specific part of our docs site, hence the multi-instance stuff.We want to version all of the docs that are managed by this
@docusaurus/plugin-content-docs
instance. So, I've used the "regular" docusaurus method to make a new version. When configuring thedocusaurus-plugin-openapi-docs
instance, I'm adding versions so that I could update the "old" versions if it ever becomes necessary.Maybe this isn't the "best" or "typical" way of accomplishing this? Essentially we're looking to version everything under a
/certain/url/path
without versioning anything else. Is there already any established precedent for this kind of use-case?The relevant config in the working branch can be found here, for those curious enough to dive in.
Your Environment
The text was updated successfully, but these errors were encountered: