-
Notifications
You must be signed in to change notification settings - Fork 246
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
Check if the outputDir exists before attempting to create the version… #892
Check if the outputDir exists before attempting to create the version… #892
Conversation
Visit the preview URL for this PR (updated for commit 369a32a): https://docusaurus-openapi-36b86--pr892-c4ls8uvo.web.app (expires Thu, 22 Aug 2024 13:20:35 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
Hi @tyler-mairose-sp, install the latest canary release if you need it sooner. As for #893 I think the implementation works but I have concerns that it may be too open, i.e. it would effectively execute/eval whatever function is provided by the user...but not yet decided on what the actual risk is. Have you considered alternative approaches, perhaps a custom vendor extension that we could use to inject the classname? |
Hey @sserrata, TLDR: I haven't thought of a better way yet. I originally wrote it so that I did try to make it open so that more code changes would not be required in the future. A user of this plugin could specify the custom class as the key and their function check as the value in the plugin configuration. My thought was that whomever uses the plugin would be the one putting in their function check so it would be okay, but I am not sure what all could be run from that function's context. |
One other idea that may work today: have you tried implementing a custom mustache template for this? The idea would be to create if statements that apply a specific
|
And here's a snippet of my plugin config showing how to define the template:
|
Sorry, forgot to add this...technically, there is a way to write an if statement that checks the value of the extension, but it would require writing some preprocessing logic that is currently not open/exposed via the plugin options. That said, maybe providing a way to pass custom template functions is another viable path to supporting this. |
I did try this, when I got it to add the class name I wanted alongside the
I can try this out but I would need an example on how it would work or where it is in the code to test and create a new PR with the necessary changes to the plugin. I appreciate the consideration, we love this plugin and find great value from it. I am happy to help contribute to make it better for everyone that uses it. |
…s.json file
Description
When generating API specifications using the versioning configuration, there is not check if the directory exists like in the generateApiDocs function. This results in an error when creating the versions.json file.
Motivation and Context
This change is required so that you can generate versioned docs without any issues.
How Has This Been Tested?
I changed my version of the plugin locally and verified that this does in fact fix the issue. I generated versioned api docs and did not get the error after implementing this change.
Screenshots (if appropriate)
Types of changes
Checklist