Skip to content

Commit 0f5f9d9

Browse files
committed
add swagger validator
1 parent 6f92caa commit 0f5f9d9

File tree

5 files changed

+298
-29
lines changed

5 files changed

+298
-29
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
<img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square"
99
alt="Standard" />
1010
</a>
11-
</div>
11+
<a href="http://validator.swagger.io/validator/debug?url=https://raw.githubusercontent.com/developmentseed/osm-teams/master/docs/api.yml">
12+
<img src="http://validator.swagger.io/validator?url=https://raw.githubusercontent.com/developmentseed/osm-teams/master/docs/api.yml">
13+
</a>
14+
</div>
1215

1316
Check the beta 👉 <!-- markdownlint-disable MD034 -->https://mapping.team
1417
<!-- markdownlint-enable MD034 -->

docs/api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ create a client
2323

2424
##### Responses
2525

26-
| Code | Description | Schema |
27-
| ---- | ----------- | ------ |
28-
| 200 | oath 2.0 client | object |
26+
| Code | Description |
27+
| ---- | ----------- |
28+
| 200 | oath 2.0 client |
2929

3030
### /clients/{id}
3131

docs/api.yml

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ info:
88
servers:
99
- url: /api
1010

11-
consumes:
12-
- application/json
13-
14-
produces:
15-
- application/json
16-
1711
tags:
1812
- name: teams
1913
description: Teams
@@ -255,12 +249,13 @@ components:
255249
description: the timestamp of the time and date the client was last updated
256250
format: date-time
257251
ResponseError:
258-
statusCode:
259-
type: integer
260-
error:
261-
type: string
262-
message:
263-
type: string
252+
properties:
253+
statusCode:
254+
type: integer
255+
error:
256+
type: string
257+
message:
258+
type: string
264259
parameters:
265260
ClientId:
266261
name: id
@@ -304,11 +299,12 @@ paths:
304299
responses:
305300
'200':
306301
description: A JSON array of client objects
307-
application/json:
308-
schema:
309-
type: array
310-
items:
311-
$ref: '#/components/schemas/Client'
302+
content:
303+
application/json:
304+
schema:
305+
type: array
306+
items:
307+
$ref: '#/components/schemas/Client'
312308
post:
313309
summary: create a client
314310
tags:
@@ -322,11 +318,13 @@ paths:
322318
responses:
323319
'200':
324320
description: oath 2.0 client
325-
schema:
326-
type: object
327-
properties:
328-
client:
329-
$ref: '#/components/schemas/Client'
321+
content:
322+
application/json:
323+
schema:
324+
type: object
325+
properties:
326+
client:
327+
$ref: '#/components/schemas/Client'
330328
/clients/{id}:
331329
parameters:
332330
- $ref: '#/components/parameters/ClientId'

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
"version": "0.0.0",
44
"description": "Teams for OpenStreetMap!",
55
"scripts": {
6+
"docs:validate": "swagger-cli validate docs/api.yml",
67
"docs:api": "swagger-markdown -i docs/api.yml -o docs/api.md",
7-
"docs": "npm run docs:api",
8+
"docs": "npm run docs:validate && npm run docs:api",
89
"dev": "NODE_ENV=development nodemon --watch app app/index.js",
910
"migrate": "knex --knexfile app/db/knexfile.js migrate:latest",
1011
"test": "NODE_ENV=test ava app/tests/**/*.test.js -c 1 --serial --verbose",
@@ -78,6 +79,7 @@
7879
"yamljs": "^0.3.0"
7980
},
8081
"devDependencies": {
82+
"@apidevtools/swagger-cli": "^4.0.2",
8183
"@babel/core": "^7.5.5",
8284
"@babel/preset-env": "^7.5.5",
8385
"@babel/preset-react": "^7.0.0",

0 commit comments

Comments
 (0)