wip
This commit is contained in:
@@ -38,7 +38,7 @@ export function genOpenapiSpec(config: Config) {
|
||||
},
|
||||
};
|
||||
|
||||
for (const [name, endpoint] of Object.entries(endpoints).filter(([name, ep]) => !ep.secure)) {
|
||||
for (const [name, endpoint] of Object.entries(endpoints).filter(([name, ep]) => !('secure' in ep) || !ep.secure)) {
|
||||
const errors = {} as any;
|
||||
|
||||
if ('errors' in endpoint && endpoint.errors) {
|
||||
@@ -107,7 +107,7 @@ export function genOpenapiSpec(config: Config) {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: '#/components/schemas/Error',
|
||||
$ref: '#/components/schemas/ApiError',
|
||||
},
|
||||
examples: { ...errors, ...basicErrors['400'] },
|
||||
},
|
||||
@@ -118,7 +118,7 @@ export function genOpenapiSpec(config: Config) {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: '#/components/schemas/Error',
|
||||
$ref: '#/components/schemas/ApiError',
|
||||
},
|
||||
examples: basicErrors['401'],
|
||||
},
|
||||
@@ -129,7 +129,7 @@ export function genOpenapiSpec(config: Config) {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: '#/components/schemas/Error',
|
||||
$ref: '#/components/schemas/ApiError',
|
||||
},
|
||||
examples: basicErrors['403'],
|
||||
},
|
||||
@@ -140,7 +140,7 @@ export function genOpenapiSpec(config: Config) {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: '#/components/schemas/Error',
|
||||
$ref: '#/components/schemas/ApiError',
|
||||
},
|
||||
examples: basicErrors['418'],
|
||||
},
|
||||
@@ -152,7 +152,7 @@ export function genOpenapiSpec(config: Config) {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: '#/components/schemas/Error',
|
||||
$ref: '#/components/schemas/ApiError',
|
||||
},
|
||||
examples: basicErrors['429'],
|
||||
},
|
||||
@@ -164,7 +164,7 @@ export function genOpenapiSpec(config: Config) {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: '#/components/schemas/Error',
|
||||
$ref: '#/components/schemas/ApiError',
|
||||
},
|
||||
examples: basicErrors['500'],
|
||||
},
|
||||
|
@@ -1,32 +1,5 @@
|
||||
import { refs } from 'misskey-js/built/schemas.js';
|
||||
|
||||
export const schemas = {
|
||||
Error: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
error: {
|
||||
type: 'object',
|
||||
description: 'An error object.',
|
||||
properties: {
|
||||
code: {
|
||||
type: 'string',
|
||||
description: 'An error code. Unique within the endpoint.',
|
||||
},
|
||||
message: {
|
||||
type: 'string',
|
||||
description: 'An error message.',
|
||||
},
|
||||
id: {
|
||||
type: 'string',
|
||||
format: 'uuid',
|
||||
description: 'An error ID. This ID is static.',
|
||||
},
|
||||
},
|
||||
required: ['code', 'id', 'message'],
|
||||
},
|
||||
},
|
||||
required: ['error'],
|
||||
},
|
||||
|
||||
...refs,
|
||||
};
|
||||
|
Reference in New Issue
Block a user