From 55f8cb4274b784e5281332c85875ef83c148d716 Mon Sep 17 00:00:00 2001 From: Tosuke Date: Fri, 6 Jan 2017 15:13:46 +0900 Subject: [PATCH] [Swagger]Following changes --- src/api/endpoints/auth/accept.js | 2 +- src/api/endpoints/auth/session/show.js | 6 +++--- src/api/endpoints/auth/session/userkey.js | 4 ++-- swagger.js | 26 +++++++++++------------ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/api/endpoints/auth/accept.js b/src/api/endpoints/auth/accept.js index d60d95aea..131a0e561 100644 --- a/src/api/endpoints/auth/accept.js +++ b/src/api/endpoints/auth/accept.js @@ -15,7 +15,7 @@ import AccessToken from '../../models/access-token'; * post: * summary: Accept a session * parameters: - * - $ref: "#/parameters/ShouldSecureKey" + * - $ref: "#/parameters/NativeToken" * - * name: token * description: Session Token diff --git a/src/api/endpoints/auth/session/show.js b/src/api/endpoints/auth/session/show.js index c91ac5a12..9072edc1c 100644 --- a/src/api/endpoints/auth/session/show.js +++ b/src/api/endpoints/auth/session/show.js @@ -14,7 +14,7 @@ import serialize from '../../../serializers/auth-session'; * parameters: * - * name: token - * description: API Token + * description: Session Token * in: formData * required: true * type: string @@ -28,7 +28,7 @@ import serialize from '../../../serializers/auth-session'; * created_at: * type: string * format: date - * description: de + * description: Date and time of the session creation * app_id: * type: string * description: Application ID @@ -37,7 +37,7 @@ import serialize from '../../../serializers/auth-session'; * description: Session Token * user_id: * type: string - * description: de + * description: ID of user who create the session * app: * $ref: "#/definitions/Application" * default: diff --git a/src/api/endpoints/auth/session/userkey.js b/src/api/endpoints/auth/session/userkey.js index 9252046e5..9905d7d84 100644 --- a/src/api/endpoints/auth/session/userkey.js +++ b/src/api/endpoints/auth/session/userkey.js @@ -12,7 +12,7 @@ import serialize from '../../../serializers/user'; * @swagger * /auth/session/userkey: * post: - * summary: Get a userkey + * summary: Get a access token(userkey) * parameters: * - * name: app_secret @@ -35,7 +35,7 @@ import serialize from '../../../serializers/user'; * properties: * userkey: * type: string - * description: User Key + * description: Access Token * user: * $ref: "#/definitions/User" * default: diff --git a/swagger.js b/swagger.js index 16e1a0bf0..e9fb84a09 100644 --- a/swagger.js +++ b/swagger.js @@ -23,7 +23,8 @@ const defaultSwagger = { }, "host": "api.misskey.local", "schemes": [ - "http" + "http", + "ws" ], "consumes": [ "application/x-www-form-urlencoded" @@ -33,24 +34,21 @@ const defaultSwagger = { ], "responses": { - "ShouldSecureKey": { + "AccessToken": { "name": "i", - "description": "secure key", + "description": "Access Token", "in": "formData", "required": true, "type": "string" }, - "SecureKey": { + + "NativeToken": { "name": "i", - "description": "secure key", + "description": "Native Access Token", "in": "formData", - "type": "string" - }, - "NormalKey": { - "name": "_userkey", - "description": "normal key", - "in": "formData", - "type": "string" + "required": true, + "type": "string", + "pattern": "^\!.+" } }, @@ -212,7 +210,9 @@ options.apis = files.map(c => {return `${apiRoot}/${c}`;}); 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'] : ['http']; + options.swaggerDefinition.schemes = config.https.enable ? + ['https', 'wss'] : + ['http', 'ws']; } var swaggerSpec = swaggerJSDoc(options);