-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add openapi jsdoc annotation with test (#200)
* add openapi jsdoc annotation with test * update snap Co-authored-by: Aras Abbasi <[email protected]> Co-authored-by: Kalin Chernev <[email protected]>
- Loading branch information
1 parent
e42c894
commit b84f5f7
Showing
5 changed files
with
253 additions
and
2 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
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,80 @@ | ||
// Imaginary API helper | ||
module.exports = function (app) { | ||
/** | ||
* @openapi | ||
* | ||
* /: | ||
* get: | ||
* operationId: listVersionsv2 | ||
* summary: List API versions | ||
* responses: | ||
* '200': | ||
* description: |- | ||
* 200 response | ||
* content: | ||
* application/json: | ||
* examples: | ||
* foo: | ||
* value: { | ||
* "versions": [ | ||
* { | ||
* "status": "CURRENT", | ||
* "updated": "2011-01-21T11:33:21Z", | ||
* "id": "v2.0", | ||
* "links": [ | ||
* { | ||
* "href": "http://127.0.0.1:8774/v2/", | ||
* "rel": "self" | ||
* } | ||
* ] | ||
* }, | ||
* { | ||
* "status": "EXPERIMENTAL", | ||
* "updated": "2013-07-23T11:33:21Z", | ||
* "id": "v3.0", | ||
* "links": [ | ||
* { | ||
* "href": "http://127.0.0.1:8774/v3/", | ||
* "rel": "self" | ||
* } | ||
* ] | ||
* } | ||
* ] | ||
* } | ||
* '300': | ||
* description: |- | ||
* 300 response | ||
* content: | ||
* application/json: | ||
* examples: | ||
* foo: | ||
* value: | | ||
* { | ||
* "versions": [ | ||
* { | ||
* "status": "CURRENT", | ||
* "updated": "2011-01-21T11:33:21Z", | ||
* "id": "v2.0", | ||
* "links": [ | ||
* { | ||
* "href": "http://127.0.0.1:8774/v2/", | ||
* "rel": "self" | ||
* } | ||
* ] | ||
* }, | ||
* { | ||
* "status": "EXPERIMENTAL", | ||
* "updated": "2013-07-23T11:33:21Z", | ||
* "id": "v3.0", | ||
* "links": [ | ||
* { | ||
* "href": "http://127.0.0.1:8774/v3/", | ||
* "rel": "self" | ||
* } | ||
* ] | ||
* } | ||
* ] | ||
* } | ||
*/ | ||
app.get('/', () => {}); | ||
}; |
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,68 @@ | ||
{ | ||
"openapi": "3.0.0", | ||
"info": { | ||
"version": "1.0.0", | ||
"title": "Sample specification testing openapi-jsdoc-annotation" | ||
}, | ||
"paths": { | ||
"/": { | ||
"get": { | ||
"operationId": "listVersionsv2", | ||
"summary": "List API versions", | ||
"responses": { | ||
"200": { | ||
"description": "200 response", | ||
"content": { | ||
"application/json": { | ||
"examples": { | ||
"foo": { | ||
"value": { | ||
"versions": [ | ||
{ | ||
"status": "CURRENT", | ||
"updated": "2011-01-21T11:33:21Z", | ||
"id": "v2.0", | ||
"links": [ | ||
{ | ||
"href": "http://127.0.0.1:8774/v2/", | ||
"rel": "self" | ||
} | ||
] | ||
}, | ||
{ | ||
"status": "EXPERIMENTAL", | ||
"updated": "2013-07-23T11:33:21Z", | ||
"id": "v3.0", | ||
"links": [ | ||
{ | ||
"href": "http://127.0.0.1:8774/v3/", | ||
"rel": "self" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"300": { | ||
"description": "300 response", | ||
"content": { | ||
"application/json": { | ||
"examples": { | ||
"foo": { | ||
"value": "{\n \"versions\": [\n {\n \"status\": \"CURRENT\",\n \"updated\": \"2011-01-21T11:33:21Z\",\n \"id\": \"v2.0\",\n \"links\": [\n {\n \"href\": \"http://127.0.0.1:8774/v2/\",\n \"rel\": \"self\"\n }\n ]\n },\n {\n \"status\": \"EXPERIMENTAL\",\n \"updated\": \"2013-07-23T11:33:21Z\",\n \"id\": \"v3.0\",\n \"links\": [\n {\n \"href\": \"http://127.0.0.1:8774/v3/\",\n \"rel\": \"self\"\n }\n ]\n }\n ]\n}\n" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": {}, | ||
"tags": [] | ||
} |
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
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