0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00

fix(core): swagger json

This commit is contained in:
Gao Sun 2022-11-12 16:39:09 +08:00
parent 6473df99d2
commit c1546f0ad8
No known key found for this signature in database
GPG key ID: 13EBE123E4773688

View file

@ -5,6 +5,7 @@ import { conditional } from '@silverhand/essentials';
import type { OpenAPIV3 } from 'openapi-types'; import type { OpenAPIV3 } from 'openapi-types';
import type { ZodStringDef } from 'zod'; import type { ZodStringDef } from 'zod';
import { import {
ZodRecord,
ZodArray, ZodArray,
ZodBoolean, ZodBoolean,
ZodEffects, ZodEffects,
@ -201,6 +202,13 @@ export const zodTypeToSwagger = (
}; };
} }
if (config instanceof ZodRecord) {
return {
type: 'object',
additionalProperties: zodTypeToSwagger(config.valueSchema),
};
}
if (config instanceof ZodArray) { if (config instanceof ZodArray) {
return { return {
type: 'array', type: 'array',