[Swagger]Add /app/show
This commit is contained in:
		
							parent
							
								
									55f8cb4274
								
							
						
					
					
						commit
						ac0824b574
					
				
					 2 changed files with 41 additions and 6 deletions
				
			
		|  | @ -7,6 +7,36 @@ import * as mongo from 'mongodb'; | ||||||
| import App from '../../models/app'; | import App from '../../models/app'; | ||||||
| import serialize from '../../serializers/app'; | import serialize from '../../serializers/app'; | ||||||
| 
 | 
 | ||||||
|  | /** | ||||||
|  |  * @swagger | ||||||
|  |  * /app/show: | ||||||
|  |  *   post: | ||||||
|  |  *     summary: Show an application's information | ||||||
|  |  *     description: Require app_id or name_id | ||||||
|  |  *     parameters: | ||||||
|  |  *       - | ||||||
|  |  *         name: app_id | ||||||
|  |  *         description: Application ID | ||||||
|  |  *         in: formData | ||||||
|  |  *         type: string | ||||||
|  |  *       - | ||||||
|  |  *         name: name_id | ||||||
|  |  *         description: Application unique name | ||||||
|  |  *         in: formData | ||||||
|  |  *         type: string | ||||||
|  |  *          | ||||||
|  |  *     responses: | ||||||
|  |  *       200: | ||||||
|  |  *         description: Success | ||||||
|  |  *         schema: | ||||||
|  |  *           $ref: "#/definitions/Application" | ||||||
|  |  *            | ||||||
|  |  *       default: | ||||||
|  |  *         description: Failed | ||||||
|  |  *         schema: | ||||||
|  |  *           $ref: "#/definitions/Error" | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * Show an app |  * Show an app | ||||||
|  * |  * | ||||||
|  |  | ||||||
							
								
								
									
										17
									
								
								swagger.js
									
										
									
									
									
								
							
							
						
						
									
										17
									
								
								swagger.js
									
										
									
									
									
								
							|  | @ -7,6 +7,8 @@ const yaml = require('js-yaml'); | ||||||
| const apiRoot = './src/api/endpoints'; | const apiRoot = './src/api/endpoints'; | ||||||
| const files = [ | const files = [ | ||||||
|   'users.js', |   'users.js', | ||||||
|  |   //app
 | ||||||
|  |   'app/show.js', | ||||||
|   //auth
 |   //auth
 | ||||||
|   'auth/accept.js', |   'auth/accept.js', | ||||||
|   //auth/session
 |   //auth/session
 | ||||||
|  | @ -21,10 +23,9 @@ const defaultSwagger = { | ||||||
|     "title": "Misskey API", |     "title": "Misskey API", | ||||||
|     "version": "aoi" |     "version": "aoi" | ||||||
|   }, |   }, | ||||||
|   "host": "api.misskey.local", |   "host": "api.misskey.xyz", | ||||||
|   "schemes": [ |   "schemes": [ | ||||||
|     "http", |     "https" | ||||||
|     "ws" |  | ||||||
|   ], |   ], | ||||||
|   "consumes": [ |   "consumes": [ | ||||||
|     "application/x-www-form-urlencoded" |     "application/x-www-form-urlencoded" | ||||||
|  | @ -33,7 +34,7 @@ const defaultSwagger = { | ||||||
|     "application/json" |     "application/json" | ||||||
|   ], |   ], | ||||||
| 
 | 
 | ||||||
|   "responses": { |   "parameters": { | ||||||
|     "AccessToken": { |     "AccessToken": { | ||||||
|       "name": "i", |       "name": "i", | ||||||
|       "description": "Access Token", |       "description": "Access Token", | ||||||
|  | @ -171,6 +172,10 @@ const defaultSwagger = { | ||||||
|           "type": "string", |           "type": "string", | ||||||
|           "description": "アプリケーションの名前" |           "description": "アプリケーションの名前" | ||||||
|         }, |         }, | ||||||
|  |         "name_id": { | ||||||
|  |           "type": "string", | ||||||
|  |           "description": "アプリケーションのユニークな名前" | ||||||
|  |         }, | ||||||
|         "description": { |         "description": { | ||||||
|           "type": "string", |           "type": "string", | ||||||
|           "description": "アプリケーションの説明" |           "description": "アプリケーションの説明" | ||||||
|  | @ -211,8 +216,8 @@ if(fs.existsSync('.config/config.yml')){ | ||||||
|   var config = yaml.safeLoad(fs.readFileSync('./.config/config.yml', 'utf8')); |   var config = yaml.safeLoad(fs.readFileSync('./.config/config.yml', 'utf8')); | ||||||
|   options.swaggerDefinition.host = `api.${config.url}`; |   options.swaggerDefinition.host = `api.${config.url}`; | ||||||
|   options.swaggerDefinition.schemes = config.https.enable ?  |   options.swaggerDefinition.schemes = config.https.enable ?  | ||||||
|                                       ['https', 'wss'] :  |                                       ['https'] :  | ||||||
|                                       ['http', 'ws']; |                                       ['http']; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| var swaggerSpec = swaggerJSDoc(options); | var swaggerSpec = swaggerJSDoc(options); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue