Introduce OpenAPI specs (#4351)

* wip

* wip

* wip

* Update index.ts

* Update gen-openapi-spec.ts

* Update api.ja-JP.md

* Fix

* Improve doc

* Update gen-openapi-spec.ts

* Update redoc.html

* Improve doc

* Update gen-openapi-spec.ts

* Improve doc

* Update CHANGELOG.md
This commit is contained in:
syuilo
2019-02-23 11:20:58 +09:00
committed by GitHub
parent 68a6758302
commit 52774bbe64
173 changed files with 1091 additions and 876 deletions

View File

@@ -21,6 +21,7 @@ import getNoteSummary from '../../misc/get-note-summary';
import fetchMeta from '../../misc/fetch-meta';
import Emoji from '../../models/emoji';
import * as pkg from '../../../package.json';
import { genOpenapiSpec } from '../api/gen-openapi-spec';
const client = `${__dirname}/../../client/`;
@@ -83,10 +84,19 @@ router.get('/manifest.json', async ctx => {
// Docs
router.use('/docs', docs.routes());
router.get('/api-doc', async ctx => {
await send(ctx as any, '/assets/redoc.html', {
root: client
});
});
// URL preview endpoint
router.get('/url', require('./url-preview'));
router.get('/api.json', async ctx => {
ctx.body = genOpenapiSpec();
});
const getFeed = async (acct: string) => {
const { username, host } = parseAcct(acct);
const user = await User.findOne({