Skip to content

Conversation

@mathis-m
Copy link

@mathis-m mathis-m commented Jul 2, 2022

@kael-shipman @Randerspl Hi guys! I found some minutes for a minor investigation. I just looked at the code and with the knowledge of the swagger ui system from back then I think this because of this lines of code: https://github.com/kael-shipman/swagger-ui-plugins/blob/hierarchical-tags/packages/hierarchical-tags/src/HierarchicalOperations.jsx#L79-L98

The taggedOperations selector of swagger-ui returns a map to a datastructure containing information about the tag itself and about its operations. So operations on the same level will work with the current plugin logic. But in case there are hirachical tags that end on different levels there is a issue.
What the plugin tries to do is to create a nested map by splitting the tags at a delimiter. In case that a nested tag at any level already exists, like in your example tag1 and tag2. And then a tag follows that ends at at a already tracked tag level like first level or second level, nothing will be done. Instead the logic should combine the operations on this level with the ones of the current tag. And probably also add the tag information if available.

const parts = // split tag
for(const tag of parts) 
{
  // old logic if
  else if(tag === parts[parts.length - 1])
    //merge operations and tag info
  //old logic
} 

I will try to provide PR when I get home later today.

Best Regards
Mathis

Sent from a mobile phone – please excuse the brevity of the comment.

Originally posted by @mathis-m in swagger-api/swagger-ui#5969 (comment)

Result using minimal reproduction json

image

@mathis-m mathis-m changed the base branch from master to hierarchical-tags July 2, 2022 00:28
@kael-shipman
Copy link
Owner

Good catch! Thanks for the quick fix. Merging and releasing.

@kael-shipman kael-shipman merged commit 28826f3 into kael-shipman:hierarchical-tags Jul 4, 2022
@randers-bit
Copy link

randers-bit commented Jul 7, 2022

Hello i have a question about release.
I can see 1.0.2 version on npm, but currently im using webjar in my project.
On webjar repo i can see 1.0.0 version only.
I don't have great knowledge about it: webjars are generated automatically from npm or this needs to be done manually like publishing to npm?

@kael-shipman
Copy link
Owner

@Randerspl sorry for the delay! Didn't notice this. Unfortunately I don't know much about webjars. I also don't know how the original package got up there to begin with, although I'm glad to see it did! I just did a little research and it looks like it may be as simple as running a get call against the webjar server (I just found this example of it for Lerna by googling). I'm not around my machine right now, but you could try that, and if you have trouble, i could see if i can do something about it later this week. Lemme know if that helps....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants