Skip to content

Add handling for path/operation conflicts on the join command #2766

@nickcorby

Description

@nickcorby

Describe the problem to be solved
I'm using Redocly to bundle over a dozen different APIs into their own spec files, which works great. However, I'm having a bit of trouble joining all of the bundle output files using the join command, which we would like to use for our API documentation. Each API is completely unique, except for a few cases that are causing conflict errors from the join command:

  • Every API has the same ping check endpoint GET /api/v2/pingdom
  • Every endpoint has an OPTIONS operation. This causes conflicts for certain paths that are utilised by multiple APIs. e.g. /api/v1/thing. If both API 1 and API 2 have unique methods under this path, they will both also have an OPTIONS method. This causes a Conflict on paths error.

The error output I'm getting is:
Conflict on **paths** => /api/v2/pingdom : **get** in files: {input file paths}

Describe the solution you'd like
It would be great if we could include some sort of conflict handling for these cases.

As an example, the GET /api/v2/pingdom method is identical for every API - an --ignore-duplicate-operations option (or similar) to ignore conflicts when the operation is identical would allow you to join the input files. I would expect this option to add the first unique instance of an operation, and then skip the rest.

Describe alternatives you've considered
The best alternative I can think of would be to have a decorator that removes the /api/v2/pingdom paths & OPTIONS operations during the bundle command, that could then be applied to a separate API configuration in redocly.yaml. This would allow you to bundle every API without the paths/operations causing conflicts during the join command, thus allowing you to join them without issue (in theory).

Additional context

Process I'm following:

  1. redocly bundle - bundles every API configured in redocly.yaml
  2. redocly join openapi/output/bundle/test/au/*.yaml --output openapi/output/join/test/api-gateway-au-test.yaml/ --without-x-tag-groups - joins every API spec for the au-test environment into a single file

Please let me know if you require any additional details.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions