Skip to content

Duplicate routes and wrong page if tagname and operationid have the same name #1110

Open
@florianstoll

Description

@florianstoll

Describe the bug

If the OpenAPI contains a tag which has the same name as an operationid in the same file and the tag is added to the resource the tag page (xxx.tag.mdx) is loading the resource instead of the tag page and there are warnings of duplicate routes.
The api page has the same doc id as the resource page.

Expected behavior

If you click on the tag or resource page it should open regardless of any name conflict. There should be no name dependency between resource and tag names.

Current behavior

If you click on the tag page with generated-index it loads the resource page instead of the tag page. Child resource page with the same name is working fine because it overrides the tag route.

Possible solution

The tag page should get a non conflicting doc id (e.g. prefix tag_xxx) that makes it possible to open the tag or child resource page. The sidebar must also be aware of this new name schema.

Steps to reproduce

  1. Create OpenAPI with a resource and operationid e.g. users
  2. Add global and local tag to the resource with the same name e.g. users
  3. Regenerate all docs (no warning)
  4. Build docusaurus (warning duplicate routes found should appear)
    --> Attempting to create page at /....../tagname but a page already exists at this route.
  5. Try to open generated resource page (ok)
  6. Try to open generated tag page (it opens the resource page)

Context

There is currently no solution because the OpenAPI spec does not contain any constraints on tag names. Ignoring the warnings at the moment and communicating the constraint is the only way to deal with that.

Your Environment

  • Version used: docusaurus-plugin-openapi-docs 4.3.0 + docusaurus core 3.6.3
  • Environment name and version: Firefox
  • Operating System and version (desktop or mobile): Desktop

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions