-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #205 from feenst/update-validation-for-object
Align schema validation with specification for objects
- Loading branch information
Showing
3 changed files
with
100 additions
and
1 deletion.
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
86 changes: 86 additions & 0 deletions
86
test/specs/validate-spec/valid/only-validate-required-properties-on-objects.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,86 @@ | ||
swagger: "2.0" | ||
info: | ||
title: API documentation | ||
version: "1.0.0" | ||
paths: | ||
/product: | ||
get: | ||
responses: | ||
"200": | ||
schema: | ||
$ref: "#/definitions/product" | ||
description: Successful | ||
/products: | ||
get: | ||
responses: | ||
"200": | ||
schema: | ||
$ref: "#/definitions/products" | ||
description: Successful | ||
/mood: | ||
get: | ||
responses: | ||
"200": | ||
schema: | ||
$ref: "#/definitions/mood" | ||
description: Successful | ||
/temperature: | ||
get: | ||
responses: | ||
"200": | ||
schema: | ||
$ref: "#/definitions/temperature" | ||
description: Successful | ||
/age: | ||
get: | ||
responses: | ||
"200": | ||
schema: | ||
$ref: "#/definitions/age" | ||
description: Successful | ||
/hunger: | ||
get: | ||
responses: | ||
"200": | ||
schema: | ||
$ref: "#/definitions/hunger" | ||
description: Successful | ||
definitions: | ||
product: | ||
type: object | ||
properties: | ||
expiration: | ||
type: string | ||
format: date | ||
name: | ||
type: string | ||
weight: | ||
type: number | ||
required: | ||
- name | ||
products: | ||
type: array | ||
items: | ||
$ref: "#/definitions/product" | ||
required: | ||
- items # <--- Should not be validated since type is not object | ||
mood: | ||
type: string | ||
example: nostalgic | ||
required: | ||
- length # <--- Should not be validated since type is not object | ||
temperature: | ||
type: number | ||
example: 86 | ||
required: | ||
- precision # <--- Should not be validated since type is not object | ||
age: | ||
type: integer | ||
example: 42 | ||
required: | ||
- factors # <--- Should not be validated since type is not object | ||
hunger: | ||
type: boolean | ||
example: true | ||
required: | ||
- truth # <--- Should not be validated since type is not object |
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