From ac0824b57477051bddb8a43392f45a9d5492c3e2 Mon Sep 17 00:00:00 2001 From: Tosuke Date: Fri, 6 Jan 2017 16:16:53 +0900 Subject: [PATCH] [Swagger]Add /app/show --- src/api/endpoints/app/show.js | 30 ++++++++++++++++++++++++++++++ swagger.js | 17 +++++++++++------ 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/src/api/endpoints/app/show.js b/src/api/endpoints/app/show.js index 8d12f9aeb..2b651d53a 100644 --- a/src/api/endpoints/app/show.js +++ b/src/api/endpoints/app/show.js @@ -7,6 +7,36 @@ import * as mongo from 'mongodb'; import App from '../../models/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 * diff --git a/swagger.js b/swagger.js index e9fb84a09..0deff2c5a 100644 --- a/swagger.js +++ b/swagger.js @@ -7,6 +7,8 @@ const yaml = require('js-yaml'); const apiRoot = './src/api/endpoints'; const files = [ 'users.js', + //app + 'app/show.js', //auth 'auth/accept.js', //auth/session @@ -21,10 +23,9 @@ const defaultSwagger = { "title": "Misskey API", "version": "aoi" }, - "host": "api.misskey.local", + "host": "api.misskey.xyz", "schemes": [ - "http", - "ws" + "https" ], "consumes": [ "application/x-www-form-urlencoded" @@ -33,7 +34,7 @@ const defaultSwagger = { "application/json" ], - "responses": { + "parameters": { "AccessToken": { "name": "i", "description": "Access Token", @@ -171,6 +172,10 @@ const defaultSwagger = { "type": "string", "description": "アプリケーションの名前" }, + "name_id": { + "type": "string", + "description": "アプリケーションのユニークな名前" + }, "description": { "type": "string", "description": "アプリケーションの説明" @@ -211,8 +216,8 @@ if(fs.existsSync('.config/config.yml')){ var config = yaml.safeLoad(fs.readFileSync('./.config/config.yml', 'utf8')); options.swaggerDefinition.host = `api.${config.url}`; options.swaggerDefinition.schemes = config.https.enable ? - ['https', 'wss'] : - ['http', 'ws']; + ['https'] : + ['http']; } var swaggerSpec = swaggerJSDoc(options);