-
-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix second level relative ref in property resolving (#622)
Co-authored-by: Dmitriy Lukiyanchuk <[email protected]>
- Loading branch information
Showing
5 changed files
with
203 additions
and
0 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
93 changes: 93 additions & 0 deletions
93
openapi3/testdata/refInRefInProperty/common-data-objects/problem-details-0.0.1.schema.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,93 @@ | ||
{ | ||
"title": "Problem details", | ||
"description": "Common data object for describing an error details", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": [ | ||
"type", | ||
"title", | ||
"status" | ||
], | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"description": "Unique error code", | ||
"minLength": 1, | ||
"example": "unauthorized", | ||
"x-docs-examples": [ | ||
"validation-error", | ||
"unauthorized", | ||
"forbidden", | ||
"internal-server-error", | ||
"wrong-basket", | ||
"not-found" | ||
] | ||
}, | ||
"title": { | ||
"type": "string", | ||
"description": "Human readable error message", | ||
"minLength": 1, | ||
"example": "Your request parameters didn't validate", | ||
"x-docs-examples": [ | ||
"Your request parameters didn't validate", | ||
"Requested resource is not available", | ||
"Internal server error" | ||
] | ||
}, | ||
"status": { | ||
"type": "integer", | ||
"description": "HTTP status code", | ||
"maximum": 599, | ||
"minimum": 100, | ||
"example": 200, | ||
"x-docs-examples": [ | ||
"200", | ||
"201", | ||
"400", | ||
"503" | ||
] | ||
}, | ||
"detail": { | ||
"type": "string", | ||
"description": "Human readable error description. Only for human", | ||
"example": "Basket must have more then 1 item", | ||
"x-docs-examples": [ | ||
"Basket must have more then 1 item" | ||
] | ||
}, | ||
"invalid-params": { | ||
"type": "array", | ||
"description": "Param list with errors", | ||
"items": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": [ | ||
"name", | ||
"reason" | ||
], | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"description": "field name", | ||
"minLength": 1, | ||
"example": "age", | ||
"x-docs-examples": [ | ||
"age", | ||
"color" | ||
] | ||
}, | ||
"reason": { | ||
"type": "string", | ||
"description": "Field validation error text", | ||
"minLength": 1, | ||
"example": "must be a positive integer", | ||
"x-docs-examples": [ | ||
"must be a positive integer", | ||
"must be 'green', 'red' or 'blue'" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
openapi3/testdata/refInRefInProperty/components/errors.yaml
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,66 @@ | ||
components: | ||
schemas: | ||
Error: | ||
type: object | ||
description: Error info in problem-details-0.0.1 format | ||
properties: | ||
error: | ||
$ref: "../common-data-objects/problem-details-0.0.1.schema.json" | ||
|
||
responses: | ||
400: | ||
description: "" | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/Error" | ||
examples: | ||
json: | ||
$ref: "#/components/examples/BadRequest" | ||
401: | ||
description: "" | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/Error" | ||
examples: | ||
json: | ||
$ref: "#/components/examples/Unauthorized" | ||
500: | ||
description: "" | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/Error" | ||
examples: | ||
json: | ||
$ref: "#/components/examples/InternalServerError" | ||
|
||
examples: | ||
BadRequest: | ||
summary: Wrong format | ||
value: | ||
error: | ||
type: validation-error | ||
title: Your request parameters didn't validate. | ||
status: 400 | ||
invalid-params: | ||
- name: age | ||
reason: must be a positive integer | ||
- name: color | ||
reason: must be 'green', 'red' or 'blue' | ||
Unauthorized: | ||
summary: Not authenticated | ||
value: | ||
error: | ||
type: unauthorized | ||
title: The request has not been applied because it lacks valid authentication credentials | ||
for the target resource. | ||
status: 401 | ||
InternalServerError: | ||
summary: Not handled internal server error | ||
value: | ||
error: | ||
type: internal-server-error | ||
title: Internal server error. | ||
status: 500 |
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,29 @@ | ||
openapi: 3.0.3 | ||
|
||
info: | ||
title: "Reference in reference in property example" | ||
version: "1.0.0" | ||
paths: | ||
/api/test/ref/in/ref/in/property: | ||
post: | ||
requestBody: | ||
content: | ||
multipart/form-data: | ||
schema: | ||
type: object | ||
properties: | ||
file: | ||
type: array | ||
items: | ||
type: string | ||
format: binary | ||
required: true | ||
responses: | ||
200: | ||
description: "Files are saved successfully" | ||
400: | ||
$ref: "./components/errors.yaml#/components/responses/400" | ||
401: | ||
$ref: "./components/errors.yaml#/components/responses/401" | ||
500: | ||
$ref: "./components/errors.yaml#/components/responses/500" |