elements icon indicating copy to clipboard operation
elements copied to clipboard

feat: allow to use `x-tagGroups` extension to define tree structure

Open weyert opened this issue 1 year ago • 11 comments

Allow to use the x-tagGroups and x-displayName vendor extensions to define the structure of table of contents

fixes #1390

Elements Default PR Template

In general, make sure you have: (check the boxes to acknowledge you've followed this template)

  • [X] Read CONTRIBUTING.md

weyert avatar Jun 24 '24 18:06 weyert

Deploy Preview for stoplight-elements ready!

Name Link
Latest commit fc7b9ac2acb1b5afbe079377a0a9081b0acff401
Latest deploy log https://app.netlify.com/sites/stoplight-elements/deploys/66be1eec5cfb930008a82def
Deploy Preview https://deploy-preview-2603--stoplight-elements.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Jun 24 '24 18:06 netlify[bot]

Deploy Preview for stoplight-elements-demo ready!

Name Link
Latest commit fc7b9ac2acb1b5afbe079377a0a9081b0acff401
Latest deploy log https://app.netlify.com/sites/stoplight-elements-demo/deploys/66be1eec431f8e0008c39411
Deploy Preview https://deploy-preview-2603--stoplight-elements-demo.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Jun 24 '24 18:06 netlify[bot]

@weyert Can you provide an explanation of what this does and some documentation please.

mnaumanali94 avatar Jul 19 '24 11:07 mnaumanali94

@weyert Can you provide an explanation of what this does and some documentation please.

@mnaumanali94 If the x-tagGroups-extension exists in the specification it will go to a different code path which uses the extension as defined by Redocly to generate the structure. This should fix issue #1390

See screenshot: CleanShot 2024-07-19 at 19 58 26@2x

or see: https://deploy-preview-2603--stoplight-elements.netlify.app/?path=/story/public-api--with-tag-groups

The relevant vendor extension definition in the spec:

{
"tags": [
     {
       name: 'Todos',
       'x-displayName': 'To-dos',
     },
     {
       name: 'Retrieval',
       'x-displayName': 'Retrieve To-do Items',
     },
     {
       name: 'Management',
       'x-displayName': 'Add/remove To-do Items',
     },
],
'x-tagGroups': [
     {
       name: 'Todos',
       tags: ['Retrieval', 'Management'],
     },
]
}

weyert avatar Jul 19 '24 18:07 weyert

This doesn't solve the problem of showing description for tags? Did you intend to add that too?

mnaumanali94 avatar Jul 24 '24 06:07 mnaumanali94

@mnaumanali94 It allows you use a different text for a tag in the site navigation.

I am not sure what intended use case of showing a description alongside the tag name is.

weyert avatar Jul 25 '24 14:07 weyert

Any update on this PR because I would like this to be a feature on stoplight elements as I am trying to group tags underneath another tag. So what I mean is I have an endpoint title named Order and underneath that I want subtags that say IN PROD, IN DEV, etc. This PR does exactly what I am looking for. So if this can be implemented into stoplight, that would be great.

Roshboy avatar Sep 13 '24 18:09 Roshboy

Screenshot 2024-09-14 at 1 28 27 AM

@weyert Storybook shows me this. I'm guessing something broke?

mnaumanali94 avatar Sep 13 '24 20:09 mnaumanali94

@weyert Storybook shows me this. I'm guessing something broke?

Sorry, I missed your comment. I will have a look when I am back from the office

weyert avatar Nov 19 '24 17:11 weyert

@weyert Were you able to take a look?

mnaumanali94 avatar Jan 16 '25 21:01 mnaumanali94

Screenshot 2024-09-14 at 1 28 27 AM

@weyert Storybook shows me this. I'm guessing something broke?

Sorry missed this. What do you consider broken?

weyert avatar May 28 '25 05:05 weyert