Skip to content

Swagger parser fails to link correct external reference if it refers to a file with non-unique name #2143

Open
@marcin-domanski-dis

Description

If we have a swagger file with references where only path is unique but filename is not, then swagger parser will mix responses resulting in a parser result not matching actual swagger definitions.

Example:
index.yaml with responses section like below:

paths:
  /entityA:
    get:
      responses:
        "200":
          $ref: ./responses/entityA/list.yaml
  /entityB:
    get:
      responses:
        "200":
          $ref: ./responses/entityB/list.yaml

Then both responses will be indexed with a same key resulting in only one of these is being used and other discarded.

This is because RefUtils.computeDefinitionName() will only use filename when computing external reference name

Tested with 2.1.22 and 2.1.24

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions