Created
April 23, 2021 14:11
-
-
Save mendhak/64189150b80a4e52cc88439c5318a17e to your computer and use it in GitHub Desktop.
swagger-jsdoc with JSON and YAML jsdoc examples
This file contains hidden or 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
/** | |
* @openapi | |
* "/abc": { | |
* "get": { | |
* "description": "Welcome to swagger-jsdoc!", | |
* "responses": { | |
* "200": { | |
* "description": "Returns a mysterious string.", | |
* "content": { | |
* "text/xml": { | |
* "schema": { | |
* "$ref": "#/components/schemas/MyResponse" | |
* } | |
* } | |
* } | |
* } | |
* } | |
* } | |
* } | |
*/ | |
app.get('/abc', (req, res) => { | |
res.send('Hello World!'); | |
}); | |
/** | |
* @openapi | |
* /xyz: | |
* get: | |
* description: Welcome to swagger-jsdoc! | |
* responses: | |
* '200': | |
* description: Expected response to a valid request | |
* content: | |
* application/json: | |
* schema: | |
* $ref: "#/components/schemas/MyResponse" | |
*/ | |
app.get('/xyz', (req, res) => { | |
res.send('Hello World!'); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment