This commit is contained in:
tamaina 2022-01-14 20:12:50 +09:00
parent 37bae7b929
commit 97dc9bfa70
3 changed files with 42 additions and 42 deletions

View file

@ -101,7 +101,7 @@ export type SchemaType<p extends Schema> =
p['type'] extends 'string' ?
p['enum'] extends ReadonlyArray<string> ?
NullOrUndefined<p, p['enum'][number]> :
NullOrUndefined<p, string> :
NullOrUndefined<p, string | Date> :
p['type'] extends 'boolean' ? NullOrUndefined<p, boolean> :
p['type'] extends 'array' ? NullOrUndefined<p, MyType<NonNullable<p['items']>>[]> :
p['type'] extends 'object' ? (

View file

@ -18,87 +18,87 @@ export type Param = {
};
export interface IEndpointMeta {
stability?: string; //'deprecated' | 'experimental' | 'stable';
readonly stability?: 'deprecated' | 'experimental' | 'stable';
tags?: string[];
readonly tags?: ReadonlyArray<string>;
params?: {
[key: string]: Param;
readonly params?: {
readonly [key: string]: Param;
};
errors?: {
[key: string]: {
message: string;
code: string;
id: string;
readonly errors?: {
readonly [key: string]: {
readonly message: string;
readonly code: string;
readonly id: string;
};
};
res?: Schema;
readonly res?: Schema;
/**
*
* false
*/
requireCredential?: boolean;
readonly requireCredential?: boolean;
/**
* 使
*/
requireAdmin?: boolean;
readonly requireAdmin?: boolean;
/**
* 使
*/
requireModerator?: boolean;
readonly requireModerator?: boolean;
/**
*
*
* withCredential false
*/
limit?: {
readonly limit?: {
/**
*
*/
key?: string;
readonly key?: string;
/**
* (ms)
* max
*/
duration?: number;
readonly duration?: number;
/**
* durationで指定した期間内にいくつまでリクエストできるのか
* duration
*/
max?: number;
readonly max?: number;
/**
* (ms)
*/
minInterval?: number;
readonly minInterval?: number;
};
/**
*
* false
*/
requireFile?: boolean;
readonly requireFile?: boolean;
/**
*
* false
*/
secure?: boolean;
readonly secure?: boolean;
/**
*
*
*/
kind?: string;
readonly kind?: string;
}
export interface IEndpoint {

View file

@ -7,7 +7,7 @@ import { makePaginationQuery } from '../common/make-pagination-query';
export const meta = {
tags: ['meta'],
requireCredential: false as const,
requireCredential: false,
params: {
limit: {
@ -30,48 +30,48 @@ export const meta = {
},
res: {
type: 'array' as const,
optional: false as const, nullable: false as const,
type: 'array',
optional: false, nullable: false,
items: {
type: 'object' as const,
optional: false as const, nullable: false as const,
type: 'object',
optional: false, nullable: false,
properties: {
id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
type: 'string',
optional: false, nullable: false,
format: 'id',
example: 'xxxxxxxxxx',
},
createdAt: {
type: 'string' as const,
optional: false as const, nullable: false as const,
type: 'string',
optional: false, nullable: false,
format: 'date-time',
},
updatedAt: {
type: 'string' as const,
optional: false as const, nullable: true as const,
type: 'string',
optional: false, nullable: true,
format: 'date-time',
},
text: {
type: 'string' as const,
optional: false as const, nullable: false as const,
type: 'string',
optional: false, nullable: false,
},
title: {
type: 'string' as const,
optional: false as const, nullable: false as const,
type: 'string',
optional: false, nullable: false,
},
imageUrl: {
type: 'string' as const,
optional: false as const, nullable: true as const,
type: 'string',
optional: false, nullable: true,
},
isRead: {
type: 'boolean' as const,
optional: false as const, nullable: false as const,
type: 'boolean',
optional: true, nullable: false,
},
},
},
},
};
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, async (ps, user) => {