Skip to content

$ref using '{' and '}' characters are creating wrong path to resolve Headers #2033

Description

@vfouqueron
openapi: 3.0.3
info:
  title: My Title
  description: Mydescription
  version: 0.0.1
paths:
  /nodes/{uuid}/rights:
    $ref: "traceability/nodes.yaml#/paths/~1nodes~1{uuid}~1rights"
openapi: 3.0.3
info:
  title: nodes.yaml
  version: 0.0.1
paths:
   /nodes/{uuid}/rights:
    get:
      operationId: listNodeRights
      tags:
        - Nodes

      responses:
        206:
          description: Partial
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "../rights.yaml#/components/schemas/NodeRightDto"
          headers:
            Content-Range:
              $ref: "../common-spec-openapi.yaml#/components/headers/Content-Range"
openapi: 3.0.3
info:
  title: common-spec-openapi.yaml
  version: 0.0.1
components:
  headers:
    Content-Range:
      schema:
        pattern: \d+-\d+\/\d+
        type: string
paths: {}

When in ExternalRefProcessor, in method processRefHeader, we call the join function. This function calls a new URI with "traceability/nodes.yaml#/paths/1nodes1{uuid}~1rights", the URI method throws an Exception as { is an invalid URI character, resulting into being caught and returning the source value, "traceability/nodes.yaml#/paths/1nodes1{uuid}~1rights" instead of ./common-spec-openapi.yaml#/components/headers/Content-Range

Activity

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

Metadata

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