PaloAltoNetworks / PaloAltoNetworks/docusaurus-openapi-docs
Custom item naming and path generation
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.1k
- Forks
- 315
- Avg merge
- 7d 5h
- Merged PRs (30d)
- 7
Description
Is your feature request related to a problem?
Nope
Describe the solution you'd like
It would be great to be able to control the formatting of the path and the resulting file name
The baseId is a kebab cased operationId - https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/blob/main/packages/docusaurus-plugin-openapi-docs/src/openapi/openapi.ts#L144-L146
And the resulting path is hardcoded using the id https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/blob/main/packages/docusaurus-plugin-openapi-docs/src/index.ts#L357
Perhaps adding an item ID transformer and path generator to the plugin options would be possible,
{
itemIdTransformer(item: ApiMetadata): string { }
itemPathTransformer(item: ApiMetaData): string {}
}
Describe alternatives you've considered
- Use a
patch-packagepatch - Create redirects :(
Additional context
I am migrating a documentation site to docusaurus, the content has hardcoded links to an API schema in the markdown files which uses the operationId as the file name and route.
Being able to control the name of the item and the path it is written to would mean we don't have to construct redirects or change our content
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read packages/docusaurus-plugin-openapi-docs/src/openapi/openapi.ts around lines 144-146 and packages/docusaurus-plugin-openapi-docs/src/index.ts around line 357 to trace how the base ID and generated path are formed. Review the plugin options and ApiMetadata usage before deciding how configurable naming and path generation should work; done means both the item name and output path can be controlled without requiring redirects or changing existing links.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- documentation, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100