docusaurus-openapi-docs icon indicating copy to clipboard operation
docusaurus-openapi-docs copied to clipboard

Use tag description as sidebar item description

Open korthout opened this issue 2 years ago • 5 comments

Is your feature request related to a problem?

When grouping by tag, operations are categorized using the tags as categories. On the overview page, each category shows the number of items (i.e. number of operations) in that category.

However, each tag has a description. It might be easier for users to understand the difference between the categories when the tag description is displayed for each category.

For example, https://docusaurus-openapi.tryingpan.dev/category/petstore-api shows the tags as categories of the API, and displays the number of items instead of a description.

Personally, I would like to use it here.

Describe the solution you'd like

With Docusaurus 2.4, a new sidebar item property description is introduced, showing the description instead of the number of items in that category.

We can take the openapi's tag description and directly use it in the sidebar as description.

Describe alternatives you've considered

Nothing 🤷 But thanks for all your efforts on this awesome project ❤️

Additional context

See latest release blog post: 2.4

korthout avatar Mar 24 '23 15:03 korthout

:tada: Thanks for opening your first issue here! Welcome to the community!

Hi @korthout, I was curious if you've been able to test our v2.0.0-beta.2 release with Docusaurus v2.4.0?

sserrata avatar Apr 04 '23 16:04 sserrata

Hi @sserrata 👋

I did already give that a shot, but I'm running into the following error when trying that. I'm unsure whether that originates from docusaurus-openapi-docs though. Screenshot 2023-04-04 at 18 32 56

korthout avatar Apr 04 '23 16:04 korthout

Thanks, I haven't had a chance to test for myself. Will need to see what changed between 2.3 and 2.4.

To be clear, you got the error above testing with v2.0.0-beta.2 and Docusaurus 2.4?

sserrata avatar Apr 04 '23 16:04 sserrata

To be clear, you got the error above testing with v2.0.0-beta.2 and Docusaurus 2.4?

Good that you verified this, I was locally still using v2.0.0-beta.1 😅 But after upgrading locally, I still ran into that error.

That is with these dependencies:

"dependencies": {
  "@docusaurus/core": "^2.4.0",
  "@docusaurus/preset-classic": "^2.4.0",
  "@mdx-js/react": "^1.6.22",
  "clsx": "^1.1.1",
  "docusaurus-plugin-openapi-docs": "^2.0.0-beta.2",
  "docusaurus-theme-openapi-docs": "^2.0.0-beta.2",
  "prism-react-renderer": "^1.3.1",
  "react": "^17.0.2",
  "react-dom": "^17.0.2"
},

Running:

yarn install
yarn run clean-api-docs all
yarn run gen-api-docs all
yarn start

korthout avatar Apr 04 '23 16:04 korthout

Issue addressed

sserrata avatar Jun 28 '24 20:06 sserrata