swagger-parser
swagger-parser copied to clipboard
$ref using '{' and '}' characters are creating wrong path to resolve Headers
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/~1nodes~1{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/~1nodes~1{uuid}~1rights" instead of ./common-spec-openapi.yaml#/components/headers/Content-Range