redocly-cli
redocly-cli copied to clipboard
join command creating _other tags unnecessarily
Describe the bug
I just successfully ran openapi join
on a set of OAS definitions for the first time. It very nicely joined all of the files into a single file without any errors or warnings. For every tag that was in the original files, though, the resulting openap.yaml file contained that tag and another one named {tag-name}_other. For example:
tags:
- name: account-label
x-displayName: account-label
- name: account-label_other
x-displayName: other
- name: adjustment
x-displayName: adjustment
- name: adjustment_other
x-displayName: other
All operations in the input files have tags assigned to them. In the openapi.yaml file, there are no operations that have any of these _other tags assigned to them. So, the _other tags are never used, and based on my reading of the join description, they shouldn't have been created.
Expected behavior No _other tags are created when all operations in input files already have tags.
openapi-cli
Version(s)
1.0.0.beta.54
@steve-nay-sage Would you mind providing the specs you used or example specs? I've been trying to get join to work for days unsuccessfully. It looks like others are having the same issue.
@gregorysimpson13 what version of OAS? I opened #339 before...
@adamaltman OAS 3 openapi-cli 1.0.0-beta.58
I didn't have any problems with the join command working and producing output. Of course, it complains if an input file has structural errors, but that's actually helpful, not a problem. I can't share the specs that I'm using, but I'll see if I can create a small set of sample specs.
Okay, here's the infamous Pet Store broken into separate OAS definition files for pets, store, and users. I also created a petstore.intro.yaml file to contain just the intro fields that apply to the whole API. If you extract the zip to a folder, you should be able to run this command to produce a combined openapi.yaml file:
openapi join petstore.intro.yaml petstore.pets.yaml petstore.store.yaml petstore.users.yaml
You want to put the intro file first so that the join command uses it for the intro content.
This worked for me on Windows without any issues.
Have a great 3-day weekend! Steve
@steve-nay-sage thanks this really helps!!
@steve-nay-sage Could you please describe some definition examples to reproduce this case? The main idea with _other
prefix is to add this in cases if the operation doesn't have any tag.
I'm sorry @SmoliyY and @tatomyr -- I didn't see this question until today.
Since you know about the reason for the _other
tags, I don't understand what other information you would like me to provide.
All of my operations have tags, but the join command still adds <tag name>_other
for every tag. When I put the resulting file into Redocly or Swagger editor, the _other
tags are really obvious but there is no content. The _other
tags are just in the list of tags and are not applied to any operations, so I don't think there is any reason to have them.
@steve-nay-sage Is this issue still reproducible with the latest redocly/cli
version? Because I can not reproduce it.
Hi @SmoliyY . Yes, I can still reproduce this issue. I joined some OAS definitions, each of which had only one tag. The resulting file has those tags plus an _other tag for each one.
I am at redocly cli version 1.0.0-beta.108.
Here is a zip file containing two OAS files. If you join them, you should see two _other
tags in the tags section. If there is something wrong in these files that is causing this, please let me know what I need to change.
@steve-nay-sage thank you a lot for the response and this example! I'll mark it as a bug, and let you know if there are anything wrong with your files. Currently I cannot see anything that can cause this issue 😞
Hello @steve-nay-sage ! Thank you for the detailed description and provided examples 🙂 Unfortunately I could not reproduce this issue on the mentioned examples, in MacOS, or Windows 11 using @redocly/cli version 1.6.0. I guess it was fixed in one of the previous releases
Thank you for finding this older issue. I just tested it myself and I did not see any _other tags, so it seems to have been fixed.