Skip to content

Commit

Permalink
mark body of PATCH and POST as required in generated OpenAPI specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Nally committed May 24, 2016
1 parent 6134608 commit d8ac2ce
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 2 deletions.
6 changes: 4 additions & 2 deletions util/gen_openapispec.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ def build_response_200():
{'name': 'body',
'in': 'body',
'description': body_desciption,
'schema': schema
'schema': schema,
'required': True
}
],
'responses': {
Expand Down Expand Up @@ -415,7 +416,8 @@ def build_relationship_interface(self, entity_url_spec, query_path, rel_property
{'name': 'body',
'in': 'body',
'description': body_desciption,
'schema': post_schema
'schema': post_schema,
'required': True
},
{'name': 'Content-Type',
'in': 'header',
Expand Down
5 changes: 5 additions & 0 deletions util/test/gen_openapispec/dog-tracker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ x-interfaces:
- description: The subset of properties of the Dog being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Dog'
responses:
Expand Down Expand Up @@ -233,6 +234,7 @@ x-interfaces:
- description: The representation of the new Dog being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Dog'
- description: The media type of the body
Expand Down Expand Up @@ -329,6 +331,7 @@ x-interfaces:
- description: The representation of the new Person being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Person'
- description: The media type of the body
Expand Down Expand Up @@ -433,6 +436,7 @@ x-interfaces:
- description: The subset of properties of the Person being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Person'
responses:
Expand Down Expand Up @@ -557,6 +561,7 @@ x-interfaces:
- description: The representation of the new Dog being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Dog'
- description: The media type of the body
Expand Down
1 change: 1 addition & 0 deletions util/test/gen_openapispec/hello-message.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ x-interfaces:
- description: The subset of properties of the HelloMessage being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/HelloMessage'
responses:
Expand Down
2 changes: 2 additions & 0 deletions util/test/gen_openapispec/links-todo-list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ x-interfaces:
- description: The subset of properties of the Item being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Item'
responses:
Expand Down Expand Up @@ -233,6 +234,7 @@ x-interfaces:
- description: The representation of the new Item being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Item'
- description: The media type of the body
Expand Down
12 changes: 12 additions & 0 deletions util/test/gen_openapispec/petstore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ x-interfaces:
- description: The representation of the Image being replaced
in: body
name: body
required: true
schema:
$ref: '#/definitions/Image'
responses:
Expand Down Expand Up @@ -189,6 +190,7 @@ x-interfaces:
- description: The subset of properties of the Order being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Order'
responses:
Expand Down Expand Up @@ -321,6 +323,7 @@ x-interfaces:
- description: The subset of properties of the Pet being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Pet'
responses:
Expand Down Expand Up @@ -445,6 +448,7 @@ x-interfaces:
- description: The representation of the new Image being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Image'
- description: The media type of the body
Expand Down Expand Up @@ -541,6 +545,7 @@ x-interfaces:
- description: The representation of the new Image being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Image'
- description: The media type of the body
Expand Down Expand Up @@ -645,6 +650,7 @@ x-interfaces:
- description: The subset of properties of the Session being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Session'
responses:
Expand Down Expand Up @@ -777,6 +783,7 @@ x-interfaces:
- description: The subset of properties of the Store being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Store'
responses:
Expand Down Expand Up @@ -903,6 +910,7 @@ x-interfaces:
- description: The representation of the new Session being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Login'
- description: The media type of the body
Expand Down Expand Up @@ -999,6 +1007,7 @@ x-interfaces:
- description: The representation of the new Order being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Order'
- description: The media type of the body
Expand Down Expand Up @@ -1108,6 +1117,7 @@ x-interfaces:
- description: The representation of the new Pet being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Pet'
- description: The media type of the body
Expand Down Expand Up @@ -1204,6 +1214,7 @@ x-interfaces:
- description: The representation of the new User being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/User'
- description: The media type of the body
Expand Down Expand Up @@ -1308,6 +1319,7 @@ x-interfaces:
- description: The subset of properties of the User being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/User'
responses:
Expand Down
10 changes: 10 additions & 0 deletions util/test/gen_openapispec/property-tracker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ x-interfaces:
- description: The subset of properties of the Bicycle being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Bicycle'
responses:
Expand Down Expand Up @@ -180,6 +181,7 @@ x-interfaces:
- description: The subset of properties of the Dog being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Dog'
responses:
Expand Down Expand Up @@ -312,6 +314,7 @@ x-interfaces:
- description: The subset of properties of the Institution being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Institution'
responses:
Expand Down Expand Up @@ -436,6 +439,7 @@ x-interfaces:
- description: The representation of the new Dog or Bicycle being created
in: body
name: body
required: true
schema:
x-oneOf:
- $ref: '#/definitions/Dog'
Expand Down Expand Up @@ -544,6 +548,7 @@ x-interfaces:
- description: The subset of properties of the Person being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Person'
responses:
Expand Down Expand Up @@ -668,6 +673,7 @@ x-interfaces:
- description: The representation of the new Dog or Bicycle being created
in: body
name: body
required: true
schema:
x-oneOf:
- $ref: '#/definitions/Dog'
Expand Down Expand Up @@ -829,6 +835,7 @@ x-interfaces:
- description: The representation of the new Bicycle being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Bicycle'
- description: The media type of the body
Expand Down Expand Up @@ -925,6 +932,7 @@ x-interfaces:
- description: The representation of the new Dog being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Dog'
- description: The media type of the body
Expand Down Expand Up @@ -1021,6 +1029,7 @@ x-interfaces:
- description: The representation of the new Institution being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Institution'
- description: The media type of the body
Expand Down Expand Up @@ -1117,6 +1126,7 @@ x-interfaces:
- description: The representation of the new Person being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Person'
- description: The media type of the body
Expand Down
2 changes: 2 additions & 0 deletions util/test/gen_openapispec/site-webmaster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ x-interfaces:
- description: The subset of properties of the Person being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Person'
responses:
Expand Down Expand Up @@ -180,6 +181,7 @@ x-interfaces:
- description: The subset of properties of the Site being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Site'
responses:
Expand Down
8 changes: 8 additions & 0 deletions util/test/gen_openapispec/spec-hub-with-impl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ x-interfaces:
- description: The representation of the Content being replaced
in: body
name: body
required: true
schema:
$ref: '#/definitions/Content'
produces:
Expand Down Expand Up @@ -238,6 +239,7 @@ x-interfaces:
- description: The subset of properties of the Doc being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Doc'
responses:
Expand Down Expand Up @@ -388,6 +390,7 @@ x-interfaces:
- description: The subset of properties of the Folder being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Folder'
responses:
Expand Down Expand Up @@ -554,6 +557,7 @@ x-interfaces:
- description: The representation of the new Doc or Folder being created
in: body
name: body
required: true
schema:
x-oneOf:
- $ref: '#/definitions/Doc'
Expand Down Expand Up @@ -674,6 +678,7 @@ x-interfaces:
- description: The subset of properties of the Group being updated
in: body
name: body
required: true
schema:
$ref: '#/definitions/Group'
responses:
Expand Down Expand Up @@ -985,6 +990,7 @@ x-interfaces:
- description: The representation of the new Doc being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Doc'
- description: The media type of the body
Expand Down Expand Up @@ -1117,6 +1123,7 @@ x-interfaces:
- description: The representation of the new Folder being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Folder'
- description: The media type of the body
Expand Down Expand Up @@ -1249,6 +1256,7 @@ x-interfaces:
- description: The representation of the new Group being created
in: body
name: body
required: true
schema:
$ref: '#/definitions/Group'
- description: The media type of the body
Expand Down
Loading

0 comments on commit d8ac2ce

Please sign in to comment.