-
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 (#143
) The fields for compose models must be arrays for an OpenAPI definition. This check raises an error if this is not the case
- Loading branch information
1 parent
9f18deb
commit 1db6b27
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.