-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added an --all-versions flag to gen-api-docs and clean-api-docs #1018
Added an --all-versions flag to gen-api-docs and clean-api-docs #1018
Conversation
… having to know which apis have versions
Hi @dv-stewarts, thanks for the contribution. I haven't had time to test but I think the approach should work. Will try to take a look either this or early next week. Thanks! |
Hi @dv-stewarts, while I was reviewing your branch I noticed something: the running For example: Before (v2)
Current (v3)
|
Update: I went ahead and opened facebook/docusaurus#10681 |
Thanks @sserrata. I doubt my change could have broken that, but since I, at best, dabble with javascript, anything is possible. |
Visit the preview URL for this PR (updated for commit bb7a97f): https://docusaurus-openapi-36b86--pr1018-6f0gui85.web.app (expires Sun, 15 Dec 2024 17:50:58 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: bf293780ee827f578864d92193b8c2866acd459f |
@sserrata I see docusaurus have closed facebook/docusaurus#10681 Do you think this can be merged in? |
Hey @dv-stewarts, yes I saw that. I suppose we could use the latest canary release from Docusaurus to test - just want to make sure the help output/usage looks good before proceeding. I suppose we could also just pass a bogus command since the error output appears to include the extended commands. |
Ah, since it's a command option, and not a command, it does show after all:
|
Question...just to clarify behavior, the idea is that In summary:
|
@sserrata I think the intention was to generate all versions, regardless of if versions exist or not. If there is only one version, then generating non-versioned docs seems to me like the behavior that was requested. Either way, thanks for merging! |
Description
Added an --all-versions flag to gen-api-docs and clean-api-docs in order to be able to generate all versions of all apis without having to individually specify each api you would like to generate all versions of.
Motivation and Context
I am trying to build a docker image of docusaurus + openapi-docs into which I can mount any arbitrary docs folder + api specs and it will detect all the apis present and generate docs for them. I do this using a function in docusaurus.config.ts. When starting the docker container it runs
docusaurus gen-api-docs all
to generate the docs. Unfortunately this only generates the current version of each api and not the historical versions. I couldn't think of a way to make the list of apis available to thedocusaurus gen...
command, so instead I'm proposing this PR, which adds a-all-versions
flag todocusaurus gen-api-docs
anddocusaurus clean-api-docs
to support this use case.I think it's also a QOL improvement as I find having to generate versions separately from the docs is a bit aggravating.
How Has This Been Tested?
I ran
tests
. It passes.I ran
tests:cypress
. It doesn't pass, but it didn't pass for me on main either.I replaced the
gen-all
andclean-all
scripts which generate all docs and then specifically generate all versions for petstore_versioned with this flag and compared the outputted files from the two using mtree. There were no differences.I'm not much a javascript developer, so I wasn't sure what more I could/should be doing. Happy to receive feedback/suggestions.
I don't believe my change will impact any other parts of the code.
Screenshots (if appropriate)
n/a
Types of changes
Checklist
I couldn't get existing tests to pass on main and I'm not sure what other tests would be appropriate as I couldn't find any existing tests for the cli.