Skip to content
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

Issue when using tag groups #792

Closed
Kkundan opened this issue Apr 2, 2024 · 13 comments
Closed

Issue when using tag groups #792

Kkundan opened this issue Apr 2, 2024 · 13 comments
Labels
bug Something isn't working

Comments

@Kkundan
Copy link

Kkundan commented Apr 2, 2024

Describe the bug

I have used tagGroup to group paths in the side bar. However instead of grouping specific paths, it is grouping all paths in every group.

[ "docusaurus-plugin-openapi-docs", { id: "openapi", docsPluginId: "classic", config: { saviynt:{ specPath: "static/api-specs/saviynt-eic-api-5.0.yaml", outputDir: "docs/eic/", sidebarOptions: { groupPathsBy: "tagGroup", // categoryLinkSource: "tag", }, version: "5.0.0", // Current version label: "v5.0.0", // Current version label baseUrl: "/developer-portal/eic/rest/5.0", // Leading slash is important versions: { "2.0.0": { specPath: "static/api-specs/saviynt-eic-api-2.0.yaml", outputDir: "docs/eic/2.0", // No trailing slash label: "v2.0.0", baseUrl: "/developer-portal/eic/rest/2.0", // Leading slash is important }, }, } satisfies OpenApiPlugin.Options, } satisfies Plugin.PluginOptions, }, ], ],

Expected behavior

I should only group specific path listed under the tagGroup

Current behavior

It is grouping all paths

Possible solution

Steps to reproduce

Screenshots

image

@Kkundan Kkundan added the bug Something isn't working label Apr 2, 2024
@sserrata
Copy link
Member

sserrata commented Apr 4, 2024

@bencagri, any idea why this might be occurring?

@bencagri
Copy link
Contributor

bencagri commented Apr 4, 2024

hi @Kkundan , have you tried to rebuild the docs with clean-api and gen-api commands?

@Kkundan
Copy link
Author

Kkundan commented Apr 4, 2024

Hi @bencagri : I have tried yarn docusaurus clean-api-docs all and yarn docusaurus clean-api-docs:version saviynt:all. I have also tried manually deleting doc folder contents

@bencagri
Copy link
Contributor

bencagri commented Apr 5, 2024

this is weird, i reproduced with the given file aviynt-eic-api-5.0.yaml. here how it looks on my local.

Screenshot 2024-04-05 at 11 43 07

but i realized, in your source x-displayName of tags is null. this is not a big deal, but if you put the key, you should also provide the value. I remember, somewhere in the code this value is checked.

on the other hand; this is the config i used if it could be a reference;

savyint: {
    specPath: "open-api-specs/savyint.yaml",
    outputDir: "docs/savyint",
    sidebarOptions: {
        groupPathsBy: "tagGroup",
        categoryLinkSource: "auto",
    }
},

Steps to reproduce; (plugin version 2.1.3)

  • download the source yaml
  • add values to sidebars.js under openApiSidebar
  • add plugin config under docusaurus-plugin-openapi-docs in docusaurus.config.js
  • run clean-api-docs and gen-api-docs commands
  • run yarn start

and i can see the results.

@Kkundan
Copy link
Author

Kkundan commented Apr 5, 2024

thanks @bencagri but I am actually currently using 3.0.0-beta.10 and not 2.1.3 . do you see the same result in that version too ?

@stakoov
Copy link
Contributor

stakoov commented Apr 10, 2024

The issue might be the yarn docusaurus clean-api-docs all not deleting the sidebar.js (.ts) and for some reason in version 3.0 (not sure what is behivier in versino 2.0) when gen-api-docs it's not regenerated.

@Kkundan can you delete the docs/open-api/sidebar.js/ts

@Kkundan
Copy link
Author

Kkundan commented Apr 10, 2024

@stakoov I have delete them and regenerated but still the same issue

@Kkundan
Copy link
Author

Kkundan commented Apr 15, 2024

@stakoov @bencagri would appreciate if you can extend some help , I tried all options but I am unable to make it work

@bencagri
Copy link
Contributor

Hello @Kkundan , unfortunately I do have a busy schedule to check this up with 3.0-beta tag. I will take a glance as soon as I can.

@stakoov
Copy link
Contributor

stakoov commented Apr 16, 2024

Hi @Kkundan I will investigate this one later this week.

@Kkundan
Copy link
Author

Kkundan commented Apr 22, 2024

@stakoov I see the same issue in your tryingpan app : https://docusaurus-openapi.tryingpan.dev/category/restaurant-api

docusaurus-openapi-docs-issue

@ElliotFriend
Copy link
Contributor

ElliotFriend commented Jun 8, 2024

I poked around a bit in my local node_modules, using the v3.0.0-beta.10 release, I think this bug was introduced in commit 9cc7cf5. I don't really have the context about what problem that commit fixed, but I think a solution might be to wrap that particular line in a check like this:

if (sidebarOptions.groupPathsBy !== "tagGroup") {
    apiTags = uniq(apiTags.concat(operationTags));
}

@Kkundan @stakoov Maybe that could help with your troubleshooting?

@ElliotFriend
Copy link
Contributor

ElliotFriend commented Jun 26, 2024

Made some PRs to address this one: #854 and #853

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants