-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: oas dereference path item is broken (#859)
* fix: unescape json references special chars Characters '/' and '~' are escaped with respectively '~1' and '~0' cf: https://swagger.io/docs/specification/v3_0/using-ref/ and must be unescaped accordingly. * fix: handle dereference of path items see Apicurio/apicurio-studio#3030 --------- Co-authored-by: Benjamin Ledentec <[email protected]>
- Loading branch information
Showing
14 changed files
with
572 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 125 additions & 0 deletions
125
src/test/resources/fixtures/dereference/oai2/path-item-dereference.expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
{ | ||
"swagger": "2.0", | ||
"paths": { | ||
"/pets": { | ||
"get": { | ||
"summary": "List Pets", | ||
"description": "Returns all pets from the system that the user has access to", | ||
"operationId": "listPets", | ||
"parameters": [ | ||
{ | ||
"name": "token", | ||
"in": "header", | ||
"description": "token to be passed as a header", | ||
"required": true, | ||
"type": "array", | ||
"items": { | ||
"type": "integer", | ||
"format": "int64" | ||
}, | ||
"collectionFormat": "csv" | ||
}, | ||
{ | ||
"name": "user", | ||
"in": "body", | ||
"description": "user to add to the system", | ||
"required": true, | ||
"schema": { | ||
"$ref": "#/definitions/Widget20" | ||
}, | ||
"allowEmptyValue": false | ||
}, | ||
{ | ||
"$ref": "#/parameters/skipParam" | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "A simple string response", | ||
"schema": { | ||
"$ref": "#/definitions/Widget20" | ||
} | ||
}, | ||
"500": { | ||
"$ref": "#/responses/GeneralError" | ||
} | ||
} | ||
}, | ||
"post": { | ||
"summary": "Add Pet", | ||
"description": "Add a pet", | ||
"operationId": "AddPets", | ||
"parameters": [ | ||
{ | ||
"name": "pet", | ||
"in": "body", | ||
"description": "pet to add to the system", | ||
"required": true, | ||
"schema": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "number" | ||
}, | ||
"name": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "A simple string response" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"Widget20": { | ||
"title": "Example Schema", | ||
"type": "object", | ||
"minProperties": 2, | ||
"maxProperties": 3, | ||
"readOnly": false, | ||
"properties": { | ||
"firstName": { | ||
"type": "string" | ||
}, | ||
"lastName": { | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 128 | ||
}, | ||
"age": { | ||
"description": "Age in years", | ||
"type": "integer", | ||
"minimum": 0 | ||
} | ||
}, | ||
"required": [ | ||
"firstName", | ||
"lastName" | ||
] | ||
} | ||
}, | ||
"parameters": { | ||
"skipParam": { | ||
"name": "skip", | ||
"in": "query", | ||
"description": "number of items to skip", | ||
"required": true, | ||
"type": "integer", | ||
"format": "int32" | ||
} | ||
}, | ||
"responses": { | ||
"GeneralError": { | ||
"description": "General Error", | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/test/resources/fixtures/dereference/oai2/path-item-dereference.input.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"swagger": "2.0", | ||
"paths": { | ||
"/pets": { | ||
"$ref": "https://apis20.example.com/components.js#/paths/~1pets", | ||
"post": { | ||
"summary": "Add Pet", | ||
"description": "Add a pet", | ||
"operationId": "AddPets", | ||
"parameters": [ | ||
{ | ||
"name": "pet", | ||
"in": "body", | ||
"description": "pet to add to the system", | ||
"required": true, | ||
"schema": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "number" | ||
}, | ||
"name": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "A simple string response" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.