Skip to content

Commit

Permalink
Unescape ref uri before lookup attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Allen committed Jun 30, 2020
1 parent c94e07d commit 02a31f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/openapi_parser/concerns/findable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module OpenAPIParser::Findable
# @param [String] reference
# @return [OpenAPIParser::Findable]
def find_object(reference)
reference = URI.unescape(reference)
return self if object_reference == reference
remote_reference = !reference.start_with?('#')
return find_remote_object(reference) if remote_reference
Expand Down
10 changes: 8 additions & 2 deletions spec/data/path-item-ref.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ info:
version: 1.0.0
title: OpenAPI3 Test
paths:
/sample:
/sample/{sample_id}:
parameters:
- name: sample_id
in: path
required: true
schema:
type: string
post:
description: override here
requestBody:
Expand All @@ -20,4 +26,4 @@ paths:
'204':
description: empty
/ref-sample:
$ref: '#/paths/~1sample'
$ref: '#/paths/~1sample~1%7Bsample_id%7D'

0 comments on commit 02a31f6

Please sign in to comment.