forked from FoundKeyGang/FoundKey
[Swagger]Following changes
This commit is contained in:
parent
0420fee5d2
commit
55f8cb4274
4 changed files with 19 additions and 19 deletions
|
@ -15,7 +15,7 @@ import AccessToken from '../../models/access-token';
|
||||||
* post:
|
* post:
|
||||||
* summary: Accept a session
|
* summary: Accept a session
|
||||||
* parameters:
|
* parameters:
|
||||||
* - $ref: "#/parameters/ShouldSecureKey"
|
* - $ref: "#/parameters/NativeToken"
|
||||||
* -
|
* -
|
||||||
* name: token
|
* name: token
|
||||||
* description: Session Token
|
* description: Session Token
|
||||||
|
|
|
@ -14,7 +14,7 @@ import serialize from '../../../serializers/auth-session';
|
||||||
* parameters:
|
* parameters:
|
||||||
* -
|
* -
|
||||||
* name: token
|
* name: token
|
||||||
* description: API Token
|
* description: Session Token
|
||||||
* in: formData
|
* in: formData
|
||||||
* required: true
|
* required: true
|
||||||
* type: string
|
* type: string
|
||||||
|
@ -28,7 +28,7 @@ import serialize from '../../../serializers/auth-session';
|
||||||
* created_at:
|
* created_at:
|
||||||
* type: string
|
* type: string
|
||||||
* format: date
|
* format: date
|
||||||
* description: de
|
* description: Date and time of the session creation
|
||||||
* app_id:
|
* app_id:
|
||||||
* type: string
|
* type: string
|
||||||
* description: Application ID
|
* description: Application ID
|
||||||
|
@ -37,7 +37,7 @@ import serialize from '../../../serializers/auth-session';
|
||||||
* description: Session Token
|
* description: Session Token
|
||||||
* user_id:
|
* user_id:
|
||||||
* type: string
|
* type: string
|
||||||
* description: de
|
* description: ID of user who create the session
|
||||||
* app:
|
* app:
|
||||||
* $ref: "#/definitions/Application"
|
* $ref: "#/definitions/Application"
|
||||||
* default:
|
* default:
|
||||||
|
|
|
@ -12,7 +12,7 @@ import serialize from '../../../serializers/user';
|
||||||
* @swagger
|
* @swagger
|
||||||
* /auth/session/userkey:
|
* /auth/session/userkey:
|
||||||
* post:
|
* post:
|
||||||
* summary: Get a userkey
|
* summary: Get a access token(userkey)
|
||||||
* parameters:
|
* parameters:
|
||||||
* -
|
* -
|
||||||
* name: app_secret
|
* name: app_secret
|
||||||
|
@ -35,7 +35,7 @@ import serialize from '../../../serializers/user';
|
||||||
* properties:
|
* properties:
|
||||||
* userkey:
|
* userkey:
|
||||||
* type: string
|
* type: string
|
||||||
* description: User Key
|
* description: Access Token
|
||||||
* user:
|
* user:
|
||||||
* $ref: "#/definitions/User"
|
* $ref: "#/definitions/User"
|
||||||
* default:
|
* default:
|
||||||
|
|
26
swagger.js
26
swagger.js
|
@ -23,7 +23,8 @@ const defaultSwagger = {
|
||||||
},
|
},
|
||||||
"host": "api.misskey.local",
|
"host": "api.misskey.local",
|
||||||
"schemes": [
|
"schemes": [
|
||||||
"http"
|
"http",
|
||||||
|
"ws"
|
||||||
],
|
],
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/x-www-form-urlencoded"
|
"application/x-www-form-urlencoded"
|
||||||
|
@ -33,24 +34,21 @@ const defaultSwagger = {
|
||||||
],
|
],
|
||||||
|
|
||||||
"responses": {
|
"responses": {
|
||||||
"ShouldSecureKey": {
|
"AccessToken": {
|
||||||
"name": "i",
|
"name": "i",
|
||||||
"description": "secure key",
|
"description": "Access Token",
|
||||||
"in": "formData",
|
"in": "formData",
|
||||||
"required": true,
|
"required": true,
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"SecureKey": {
|
|
||||||
|
"NativeToken": {
|
||||||
"name": "i",
|
"name": "i",
|
||||||
"description": "secure key",
|
"description": "Native Access Token",
|
||||||
"in": "formData",
|
"in": "formData",
|
||||||
"type": "string"
|
"required": true,
|
||||||
},
|
"type": "string",
|
||||||
"NormalKey": {
|
"pattern": "^\!.+"
|
||||||
"name": "_userkey",
|
|
||||||
"description": "normal key",
|
|
||||||
"in": "formData",
|
|
||||||
"type": "string"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -212,7 +210,9 @@ options.apis = files.map(c => {return `${apiRoot}/${c}`;});
|
||||||
if(fs.existsSync('.config/config.yml')){
|
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 ? ['https'] : ['http'];
|
options.swaggerDefinition.schemes = config.https.enable ?
|
||||||
|
['https', 'wss'] :
|
||||||
|
['http', 'ws'];
|
||||||
}
|
}
|
||||||
|
|
||||||
var swaggerSpec = swaggerJSDoc(options);
|
var swaggerSpec = swaggerJSDoc(options);
|
||||||
|
|
Loading…
Reference in a new issue