-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: error for oneOf, anyOf, allOf schema that does not use array
- added error for oneOf, anyOf, or allOf schema that is not use top-level array - updated schema-ibm test to import the default config values and made necessary changes to test to account for unexpected errors and warnings resulting from having all default values present - added tests when oneOf, anyOf, or allOf schemas are nested ("oneOf allOf," for example), when oneOf, anyOf, or allOf schema is used as a property in an obect, and when oneOf, anyOf, or allOf schema used as items in array - added test to ensure errors not issued when compose models use an array
- Loading branch information
Barrett Schonefeld
committed
Feb 21, 2020
1 parent
66c4ab7
commit ec7c365
Showing
8 changed files
with
319 additions
and
160 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
22 changes: 22 additions & 0 deletions
22
test/cli-validator/mockFiles/oas3/complexTestComposeModel.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,22 @@ | ||
openapi: 3.0.0 | ||
components: | ||
schemas: | ||
A: | ||
description: a schema | ||
type: string | ||
format: byte | ||
complexOneOfError: | ||
description: second oneOf should be array | ||
oneOf: | ||
- oneOf: | ||
$ref: '#/components/schemas/A' | ||
complexAllOfError: | ||
description: allOf should be array | ||
oneOf: | ||
- allOf: | ||
type: string | ||
complexAnyOfError: | ||
description: anyOf should be array | ||
oneOf: | ||
- anyOf: | ||
$ref: '#/components/schemas/A' |
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,21 @@ | ||
openapi: 3.0.0 | ||
components: | ||
schemas: | ||
one_of_array: | ||
type: array | ||
description: a oneOf array schema | ||
items: | ||
oneOf: | ||
type: string | ||
all_of_array: | ||
type: array | ||
description: an allOf array schema | ||
items: | ||
allOf: | ||
type: string | ||
any_of_array: | ||
type: array | ||
description: an anyOf array schema | ||
items: | ||
anyOf: | ||
type: string |
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,22 @@ | ||
openapi: 3.0.0 | ||
components: | ||
schemas: | ||
object1: | ||
type: object | ||
description: an object schema | ||
properties: | ||
one_of_error_prop: | ||
description: oneOf should be array | ||
schema: | ||
oneOf: | ||
type: string | ||
all_of_error_prop: | ||
description: allOf should be array | ||
schema: | ||
allOf: | ||
type: string | ||
any_of_error_prop: | ||
description: anyOf should be array | ||
schema: | ||
anyOf: | ||
type: string |
22 changes: 22 additions & 0 deletions
22
test/cli-validator/mockFiles/oas3/composeModelsUseArray.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,22 @@ | ||
openapi: 3.0.0 | ||
components: | ||
schemas: | ||
object1: | ||
type: object | ||
description: an object schema | ||
properties: | ||
one_of_error_prop: | ||
description: oneOf should be array | ||
schema: | ||
oneOf: | ||
- type: string | ||
all_of_error_prop: | ||
description: allOf should be array | ||
schema: | ||
allOf: | ||
- type: string | ||
any_of_error_prop: | ||
description: anyOf should be array | ||
schema: | ||
anyOf: | ||
- type: string |
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,19 @@ | ||
openapi: 3.0.0 | ||
components: | ||
schemas: | ||
A: | ||
description: a schema | ||
type: string | ||
format: byte | ||
oneOfError: | ||
description: should be array but instead just a ref | ||
oneOf: | ||
$ref: '#/components/schemas/A' | ||
allOfError: | ||
description: should be array but instead just a type | ||
allOf: | ||
type: string | ||
anyOfError: | ||
description: should be array but instead just a ref | ||
anyOf: | ||
$ref: '#/components/schemas/A' |
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
Oops, something went wrong.