Skip to content

Commit

Permalink
eliminate NonBodyParameter; pivot on Parameter.in with a switch (for
Browse files Browse the repository at this point in the history
  • Loading branch information
shockey committed Apr 12, 2019
1 parent c8afc22 commit 8aa345c
Showing 1 changed file with 35 additions and 12 deletions.
47 changes: 35 additions & 12 deletions src/plugins/json-schema-validator/swagger2-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ definitions:
$ref: "#/definitions/schema"
additionalProperties: false
headerParameterSubSchema:
type: object
required:
- name
- in
- type
additionalProperties: false
patternProperties:
"^x-":
Expand Down Expand Up @@ -434,6 +439,11 @@ definitions:
multipleOf:
$ref: "#/definitions/multipleOf"
queryParameterSubSchema:
type: object
required:
- name
- in
- type
additionalProperties: false
patternProperties:
"^x-":
Expand Down Expand Up @@ -500,6 +510,11 @@ definitions:
multipleOf:
$ref: "#/definitions/multipleOf"
formDataParameterSubSchema:
type: object
required:
- name
- in
- type
additionalProperties: false
patternProperties:
"^x-":
Expand Down Expand Up @@ -567,11 +582,15 @@ definitions:
multipleOf:
$ref: "#/definitions/multipleOf"
pathParameterSubSchema:
type: object
additionalProperties: false
patternProperties:
"^x-":
$ref: "#/definitions/vendorExtension"
required:
- name
- in
- type
- required
properties:
required:
Expand Down Expand Up @@ -631,21 +650,25 @@ definitions:
$ref: "#/definitions/enum"
multipleOf:
$ref: "#/definitions/multipleOf"
nonBodyParameter:
parameter:
switch:
- if: { properties: { in: { enum: [body] } } }
then: { $ref: "#/definitions/bodyParameter" }
- if: { properties: { in: { enum: [header] } } }
then: { $ref: "#/definitions/headerParameterSubSchema" }
- if: { properties: { in: { enum: [formData] } } }
then: { $ref: "#/definitions/formDataParameterSubSchema" }
- if: { properties: { in: { enum: [query] } } }
then: { $ref: "#/definitions/queryParameterSubSchema" }
- if: { properties: { in: { enum: [path] } } }
then: { $ref: "#/definitions/pathParameterSubSchema" }
- then:
type: object
required:
- name
- in
- type
oneOf:
- $ref: "#/definitions/headerParameterSubSchema"
- $ref: "#/definitions/formDataParameterSubSchema"
- $ref: "#/definitions/queryParameterSubSchema"
- $ref: "#/definitions/pathParameterSubSchema"
parameter:
oneOf:
- $ref: "#/definitions/bodyParameter"
- $ref: "#/definitions/nonBodyParameter"
properties:
in:
enum: [body, header, formData, query, path]
schema:
type: object
description: A deterministic version of a JSON Schema object.
Expand Down

0 comments on commit 8aa345c

Please sign in to comment.