Skip to content

Commit

Permalink
Fix mistake in API spec and content-type issue
Browse files Browse the repository at this point in the history
In the Swagger spec (.yaml), it is possible to define the supported
media types (e.g. application/json) at the API level, and then to
override them for every endpoint method.

The problem is that if we define 'consumes' at the API level, then when
the code is generated, the server expects to receive a 'Content-type'
header for every endpoint method. For GET methods, this does not make
sense.

The .yaml file has been modified because of this. The Postman example
has also been adapted.
  • Loading branch information
wasadigi committed Mar 10, 2017
1 parent beaa2f9 commit 3a2ba84
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
16 changes: 2 additions & 14 deletions examples/OpenAffectAPI.postman_collection
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"variables": [],
"info": {
"name": "Open Affect API",
"_postman_id": "af2c050f-bb8b-fad3-7ff9-a08dc9e9ba07",
"_postman_id": "9c4f0e00-66f5-64a9-4fa1-dedb9ad1cb9a",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
Expand All @@ -19,12 +19,6 @@
"description": "",
"disabled": true
},
{
"key": "//Accept",
"value": "application/json",
"description": "",
"disabled": true
},
{
"key": "Content-type",
"value": "application/json",
Expand Down Expand Up @@ -52,13 +46,7 @@
"disabled": true
},
{
"key": "//Accept",
"value": "application/json",
"description": "",
"disabled": true
},
{
"key": "Content-type",
"key": "Accept",
"value": "application/json",
"description": ""
}
Expand Down
5 changes: 1 addition & 4 deletions microservices/oa-server/src/main/resources/api-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ host: 192.168.99.100
basePath: /api
schemes:
- http
consumes:
- application/json
produces:
- application/json
paths:
/measures:
post:
Expand All @@ -41,6 +37,7 @@ paths:
get:
description: list reported measures
operationId: listMeasures
consumes:
produces:
- application/json
responses:
Expand Down

0 comments on commit 3a2ba84

Please sign in to comment.