redocly-cli icon indicating copy to clipboard operation
redocly-cli copied to clipboard

Bundling is not importing tags data used in referenced schema

Open indrek-sixfold opened this issue 10 months ago • 7 comments

When bundling spec file and there are paths imported

paths:
  /entities:
    $ref: 'entities.yaml#/paths/~1entities'

Then tags section is not updated with tags data used in imported path scheme, but used Schemas are imported.

So tags section should also be imported from source file. Tag naming conflict should be solved same way as schema objects.

indrek-sixfold avatar Oct 23 '23 12:10 indrek-sixfold

Hi @indrek-sixfold, could you provide an example that illustrates the desired solution? What's the use case of importing one API description from another? Have you considered any alternatives (like using join command or a decorator)?

tatomyr avatar Oct 23 '23 18:10 tatomyr

I have an API where endpoints are grouped by business domains. For example one definition file contains /users/... endpoints, other file /companies/... and both have defined tags descriptions in their file. If I bundle this API into single then tag definitions are not bundled. Or vice versa, if I extract for example /users/... part of API into separate definition file.

Don't ask why, but world of business requirements is colorful.

indrek-sixfold avatar Oct 24 '23 06:10 indrek-sixfold

I think I still don't fully grasp what you are trying to achieve 🙂. If you want to combine several API descriptions onto a single one, you probably should use the join command instead of bundle (see the docs).

tatomyr avatar Oct 24 '23 07:10 tatomyr

I want to extract a part from a big single API definition file.

indrek-sixfold avatar Oct 24 '23 07:10 indrek-sixfold

If I've understood this correctly, you want to combine multiple independent OpenAPI descriptions into one? Bundle will resolve all of a single OpenAPI description, but if you want to combine them to become one merged description then you should use the join command (docs: https://redocly.com/docs/cli/commands/join/). Could you please give that a try and see if that does more what you expected?

lornajane avatar Oct 26 '23 10:10 lornajane

No. I have yaml that imports paths from multiple files. If I bundle this file then paths and schemas are nicely present in bundle but tags section is not.

indrek-sixfold avatar Oct 27 '23 10:10 indrek-sixfold

Can you share an example with us? The bundle command takes an OpenAPI and resolves references into a single file, so that you can pass a one-file OpenAPI description to tools that don't support references across files. If the tags aren't defined in the OpenAPI description, bundle can't include them, because they aren't supplied.

lornajane avatar Nov 17 '23 17:11 lornajane