1
0
Fork 1
mirror of https://example.com synced 2024-11-24 06:56:41 +09:00

[Swagger]Following changes

This commit is contained in:
Tosuke 2017-01-06 15:13:46 +09:00
parent 0420fee5d2
commit 55f8cb4274
4 changed files with 19 additions and 19 deletions

View file

@ -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

View file

@ -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:

View file

@ -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:

View file

@ -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);