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

How to use x-tagGroups to generate high-level grouping? #619

Closed
Neyoui opened this issue Dec 19, 2021 · 4 comments
Closed

How to use x-tagGroups to generate high-level grouping? #619

Neyoui opened this issue Dec 19, 2021 · 4 comments
Labels
enhancement New feature or request fix confirmation pending issue has been fixed and confirmation from issue reporter is pending

Comments

@Neyoui
Copy link

Neyoui commented Dec 19, 2021

Hi,

I'm interested in high-level grouping in Redoc, but I cannot achieve it. x-tagGroups is supported in the community version of Redoc: https://github.com/Redocly/redoc#customization-options

What I also found in the documentation for redocly is an x-tagGroups example in YAML/JSON: https://redoc.ly/docs/api-reference-docs/specification-extensions/x-tag-groups/

I tried to use the "EXTENSIONS_INFO" setting but couldn't achieve the desired result.

My settings.py in Django:

"TAGS": [{"name": "Firewall", "description": "Foo"}, ],
"EXTENSIONS_INFO": {
  "x-tagGroups": [
    {
      "name": "Firewall",
      "tags": ["General", "Rules", "Log", "Report"],
    },
  ],
}

Did someone else dig into that and can help me out?

Thanks!

@tfranzel
Copy link
Owner

Hi,

TAGS is a declaration list. In itself it does nothing yet, except providing an extra description. The tag must also be used by the respective endpoints. It is either tagged automatically (via SCHEMA_PATH_PREFIX), or it can be manually annotated with extend_schema.

The settings itself look good and should be part of the schema. please confirm this. If that is all good an well, I think it comes down to above statement.

@Neyoui
Copy link
Author

Neyoui commented Dec 19, 2021

Hi,

Thanks for the speedy response.

I checked the generated schema.yaml and found out that SpectacularAPIView appends the "x-tagGroups" into the "info" section, but x-tagGroups needs to be at the main level.

How can I move x-tagGroups to a different level?

Example - Redoc navigation generation incorrect

openapi: 3.0.3
info:
  title: ''
  version: 1.0.0
  x-tagGroups:
    - name: Foo
      tags:
        - Dummy
        - Bar

Example - Redoc navigation generation correct

openapi: 3.0.3
info:
  title: ''
  version: 1.0.0
x-tagGroups:
  - name: Foo
    tags:
      - Dummy
      - Bar

tfranzel added a commit that referenced this issue Dec 19, 2021
@tfranzel
Copy link
Owner

was not possible before. i was unaware of extensions at the root level. added a new setting EXTENSIONS_ROOT for this case.

@tfranzel tfranzel added enhancement New feature or request fix confirmation pending issue has been fixed and confirmation from issue reporter is pending labels Dec 19, 2021
@Neyoui
Copy link
Author

Neyoui commented Dec 19, 2021

Thank you very much! x-tagGroups is working fine with the new EXTENSIONS_ROOT setting :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fix confirmation pending issue has been fixed and confirmation from issue reporter is pending
Projects
None yet
Development

No branches or pull requests

2 participants