From 1903aaf351e171b3c92b2420fffd5d6eeaf1ad49 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 1 May 2019 04:44:46 +0900 Subject: [PATCH] Improve API doc Fix #4825 --- src/models/repositories/page.ts | 46 +++++++++++++++++++++++++++++++ src/server/api/kinds.ts | 4 ++- src/server/api/openapi/schemas.ts | 2 ++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/src/models/repositories/page.ts b/src/models/repositories/page.ts index cbe385568e..2293edbc0d 100644 --- a/src/models/repositories/page.ts +++ b/src/models/repositories/page.ts @@ -84,5 +84,51 @@ export const packedPageSchema = { type: types.object, optional: bool.false, nullable: bool.false, properties: { + id: { + type: types.string, + optional: bool.false, nullable: bool.false, + format: 'id', + example: 'xxxxxxxxxx', + }, + createdAt: { + type: types.string, + optional: bool.false, nullable: bool.false, + format: 'date-time', + }, + updatedAt: { + type: types.string, + optional: bool.false, nullable: bool.false, + format: 'date-time', + }, + title: { + type: types.string, + optional: bool.false, nullable: bool.false, + }, + name: { + type: types.string, + optional: bool.false, nullable: bool.false, + }, + summary: { + type: types.string, + optional: bool.false, nullable: bool.true, + }, + content: { + type: types.array, + optional: bool.false, nullable: bool.false, + }, + variables: { + type: types.array, + optional: bool.false, nullable: bool.false, + }, + userId: { + type: types.string, + optional: bool.false, nullable: bool.false, + format: 'id', + }, + user: { + type: types.object, + ref: 'User', + optional: bool.false, nullable: bool.false, + }, } }; diff --git a/src/server/api/kinds.ts b/src/server/api/kinds.ts index 03ed3e7cd8..99c3795589 100644 --- a/src/server/api/kinds.ts +++ b/src/server/api/kinds.ts @@ -18,5 +18,7 @@ export const kinds = [ 'write:notifications', 'read:reactions', 'write:reactions', - 'write:votes' + 'write:votes', + 'read:pages', + 'write:pages', ]; diff --git a/src/server/api/openapi/schemas.ts b/src/server/api/openapi/schemas.ts index 34e6f8947d..229d10af2a 100644 --- a/src/server/api/openapi/schemas.ts +++ b/src/server/api/openapi/schemas.ts @@ -12,6 +12,7 @@ import { packedMutingSchema } from '../../../models/repositories/muting'; import { packedBlockingSchema } from '../../../models/repositories/blocking'; import { packedNoteReactionSchema } from '../../../models/repositories/note-reaction'; import { packedHashtagSchema } from '../../../models/repositories/hashtag'; +import { packedPageSchema } from '../../../models/repositories/page'; export function convertSchemaToOpenApiSchema(schema: Schema) { const res: any = schema; @@ -76,4 +77,5 @@ export const schemas = { Blocking: convertSchemaToOpenApiSchema(packedBlockingSchema), NoteReaction: convertSchemaToOpenApiSchema(packedNoteReactionSchema), Hashtag: convertSchemaToOpenApiSchema(packedHashtagSchema), + Page: convertSchemaToOpenApiSchema(packedPageSchema), };