fix lint
This commit is contained in:
parent
0abe2dfee0
commit
c69b72e199
573 changed files with 3318 additions and 3318 deletions
|
@ -11,16 +11,16 @@ export function genOpenapiSpec(lang = 'ja-JP') {
|
|||
info: {
|
||||
version: 'v1',
|
||||
title: 'Misskey API',
|
||||
'x-logo': { url: '/static-assets/api-doc.png' }
|
||||
'x-logo': { url: '/static-assets/api-doc.png' },
|
||||
},
|
||||
|
||||
externalDocs: {
|
||||
description: 'Repository',
|
||||
url: 'https://github.com/misskey-dev/misskey'
|
||||
url: 'https://github.com/misskey-dev/misskey',
|
||||
},
|
||||
|
||||
servers: [{
|
||||
url: config.apiUrl
|
||||
url: config.apiUrl,
|
||||
}],
|
||||
|
||||
paths: {} as any,
|
||||
|
@ -32,10 +32,10 @@ export function genOpenapiSpec(lang = 'ja-JP') {
|
|||
ApiKeyAuth: {
|
||||
type: 'apiKey',
|
||||
in: 'body',
|
||||
name: 'i'
|
||||
}
|
||||
}
|
||||
}
|
||||
name: 'i',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
function genProps(props: { [key: string]: Context; }) {
|
||||
|
@ -69,11 +69,11 @@ export function genOpenapiSpec(lang = 'ja-JP') {
|
|||
} : {}),
|
||||
...(param.name === 'Object' ? {
|
||||
...(required.length > 0 ? { required } : {}),
|
||||
properties: (param as any).props ? genProps((param as any).props) : {}
|
||||
properties: (param as any).props ? genProps((param as any).props) : {},
|
||||
} : {}),
|
||||
...(param.name === 'Array' ? {
|
||||
items: (param as any).ctx ? genProp((param as any).ctx) : {}
|
||||
} : {})
|
||||
items: (param as any).ctx ? genProp((param as any).ctx) : {},
|
||||
} : {}),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -85,8 +85,8 @@ export function genOpenapiSpec(lang = 'ja-JP') {
|
|||
for (const e of Object.values(endpoint.meta.errors)) {
|
||||
errors[e.code] = {
|
||||
value: {
|
||||
error: e
|
||||
}
|
||||
error: e,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -118,15 +118,15 @@ export function genOpenapiSpec(lang = 'ja-JP') {
|
|||
description: desc,
|
||||
externalDocs: {
|
||||
description: 'Source code',
|
||||
url: `https://github.com/misskey-dev/misskey/blob/develop/src/server/api/endpoints/${endpoint.name}.ts`
|
||||
url: `https://github.com/misskey-dev/misskey/blob/develop/src/server/api/endpoints/${endpoint.name}.ts`,
|
||||
},
|
||||
...(endpoint.meta.tags ? {
|
||||
tags: [endpoint.meta.tags[0]]
|
||||
tags: [endpoint.meta.tags[0]],
|
||||
} : {}),
|
||||
...(endpoint.meta.requireCredential ? {
|
||||
security: [{
|
||||
ApiKeyAuth: []
|
||||
}]
|
||||
ApiKeyAuth: [],
|
||||
}],
|
||||
} : {}),
|
||||
requestBody: {
|
||||
required: true,
|
||||
|
@ -135,10 +135,10 @@ export function genOpenapiSpec(lang = 'ja-JP') {
|
|||
schema: {
|
||||
type: 'object',
|
||||
...(required.length > 0 ? { required } : {}),
|
||||
properties: endpoint.meta.params ? genProps(porops) : {}
|
||||
}
|
||||
}
|
||||
}
|
||||
properties: endpoint.meta.params ? genProps(porops) : {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
responses: {
|
||||
...(endpoint.meta.res ? {
|
||||
|
@ -146,58 +146,58 @@ export function genOpenapiSpec(lang = 'ja-JP') {
|
|||
description: 'OK (with results)',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: resSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
schema: resSchema,
|
||||
},
|
||||
},
|
||||
},
|
||||
} : {
|
||||
'204': {
|
||||
description: 'OK (without any results)',
|
||||
}
|
||||
},
|
||||
}),
|
||||
'400': {
|
||||
description: 'Client error',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: '#/components/schemas/Error'
|
||||
$ref: '#/components/schemas/Error',
|
||||
},
|
||||
examples: { ...errors, ...basicErrors['400'] }
|
||||
}
|
||||
}
|
||||
examples: { ...errors, ...basicErrors['400'] },
|
||||
},
|
||||
},
|
||||
},
|
||||
'401': {
|
||||
description: 'Authentication error',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: '#/components/schemas/Error'
|
||||
$ref: '#/components/schemas/Error',
|
||||
},
|
||||
examples: basicErrors['401']
|
||||
}
|
||||
}
|
||||
examples: basicErrors['401'],
|
||||
},
|
||||
},
|
||||
},
|
||||
'403': {
|
||||
description: 'Forbidden error',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: '#/components/schemas/Error'
|
||||
$ref: '#/components/schemas/Error',
|
||||
},
|
||||
examples: basicErrors['403']
|
||||
}
|
||||
}
|
||||
examples: basicErrors['403'],
|
||||
},
|
||||
},
|
||||
},
|
||||
'418': {
|
||||
description: 'I\'m Ai',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: '#/components/schemas/Error'
|
||||
$ref: '#/components/schemas/Error',
|
||||
},
|
||||
examples: basicErrors['418']
|
||||
}
|
||||
}
|
||||
examples: basicErrors['418'],
|
||||
},
|
||||
},
|
||||
},
|
||||
...(endpoint.meta.limit ? {
|
||||
'429': {
|
||||
|
@ -205,29 +205,29 @@ export function genOpenapiSpec(lang = 'ja-JP') {
|
|||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: '#/components/schemas/Error'
|
||||
$ref: '#/components/schemas/Error',
|
||||
},
|
||||
examples: basicErrors['429']
|
||||
}
|
||||
}
|
||||
}
|
||||
examples: basicErrors['429'],
|
||||
},
|
||||
},
|
||||
},
|
||||
} : {}),
|
||||
'500': {
|
||||
description: 'Internal server error',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: '#/components/schemas/Error'
|
||||
$ref: '#/components/schemas/Error',
|
||||
},
|
||||
examples: basicErrors['500']
|
||||
}
|
||||
}
|
||||
examples: basicErrors['500'],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
spec.paths['/' + endpoint.name] = {
|
||||
post: info
|
||||
post: info,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue