Skip to content

Commit 24d58c4

Browse files
committed
address error messages for swagger-api#1808's Swagger 2.0 example
clarifies the schema and adds custom error messages for unclear error conditions
1 parent ad9f9e6 commit 24d58c4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/plugins/json-schema-validator/swagger2-schema.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,15 @@ definitions:
251251
$ref: "#/definitions/vendorExtension"
252252
not:
253253
type: object
254+
minProperties: 1
254255
additionalProperties: false
255256
patternProperties:
256257
"^x-":
257258
$ref: "#/definitions/vendorExtension"
259+
errorMessage:
260+
minProperties: "should define at least one response"
261+
not: "should define at least one response, in addition to any vendor extension (`x-*`) fields"
262+
additionalProperties: "should only have three-digit status codes, `default`, and vendor extensions (`x-*`) as properties"
258263
responseValue:
259264
oneOf:
260265
- $ref: "#/definitions/response"

src/plugins/json-schema-validator/validator/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ function jsonPointerStringToArray(str) {
7575
.filter(str => str.length > 0)
7676
}
7777

78-
// For completeness, if we need to denormalize the key...
79-
// function JSONPointerToPath(str) {
80-
// return str.split('/').map(a => a.replace('~1', '/').replace('~0', '~'))
81-
// }
82-
8378
// Convert arrays into a string. Safely, by using the JSONPath spec
8479
function normalizeKey(key) {
8580
if (!Array.isArray(key)) key = [key]

0 commit comments

Comments
 (0)