フィールドの消し方に不備があったので変更
This commit is contained in:
parent
443d4f59c0
commit
c3773a3ad1
|
@ -7,7 +7,9 @@ import type { Schema } from '@/misc/json-schema.js';
|
|||
import { refs } from '@/misc/json-schema.js';
|
||||
|
||||
export function convertSchemaToOpenApiSchema(schema: Schema) {
|
||||
const res: any = schema;
|
||||
// optional, refはスキーマ定義に含まれないので分離しておく
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const { optional, ref, ...res }: any = schema;
|
||||
|
||||
if (schema.type === 'object' && schema.properties) {
|
||||
const required = Object.entries(schema.properties).filter(([k, v]) => !v.optional).map(([k]) => k);
|
||||
|
@ -36,15 +38,8 @@ export function convertSchemaToOpenApiSchema(schema: Schema) {
|
|||
} else {
|
||||
res.$ref = $ref;
|
||||
}
|
||||
|
||||
// $refを抽出したので不要.
|
||||
res.ref = undefined;
|
||||
}
|
||||
|
||||
// requiredを抽出したので不要.
|
||||
// object以外の型も親階層のobjectによって列挙されているはずなので構わず消す
|
||||
res.optional = undefined;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue