Using createSchemaPageMD
in the markdownGenerators
config crashes the CLI
#996
Labels
bug
Something isn't working
Describe the bug
When defining the
createSchemaPageMD
function in the config file, the CLI crashes with an error when trying to regenerate the docs.Expected behavior
The CLI should not crash, but rather execute the defined function when rendering the markdown content.
Current behavior
When trying to define the
createSchemaPageMD
within the plugin config (underconfig.<my-api-name>.markdownGenerators.createSchemaPageMD
), the app crashes. It produces the following error:Full exception
Possible solution
Upon inspecting the codebase, it appears that a validator might be missing in the
markdownGenerators
:docusaurus-openapi-docs/packages/docusaurus-plugin-openapi-docs/src/options.ts
Lines 23 to 27 in 7fe9da2
At least when testing locally, just adding a
createSchemaPageMD: Joi.function(),
seems to work, though I'm not sure if this affects any other features.Steps to reproduce
Initialize a new docusaurus project with the latest version
Change directory to the project and install
docusaurus-plugin-openapi-docs
Configure a dummy API as shown in the official docs, and add the
createSchemaPageMD
markdown generatorConfiguration
Run the generate API docs command (or start the server, both should throw the exception)
Context
I'm trying to add a code snippet next to the schema definition, containing an example response of the schema:
Your Environment
Let me know if I didn't see something, happy to help you guys with a PR if needed.
The text was updated successfully, but these errors were encountered: