From 7339a85a1bb4f1a8c69a05fb5bfd61f154b24eb7 Mon Sep 17 00:00:00 2001 From: "IceHe.xyz" Date: Mon, 13 Jun 2022 18:32:52 +0800 Subject: [PATCH] feat(core): any-type parameter shows empty object in swagger example (#1110) --- packages/core/src/utils/zod.test.ts | 2 +- packages/core/src/utils/zod.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/utils/zod.test.ts b/packages/core/src/utils/zod.test.ts index 8911c2192..29ff302f0 100644 --- a/packages/core/src/utils/zod.test.ts +++ b/packages/core/src/utils/zod.test.ts @@ -58,7 +58,7 @@ describe('zodTypeToSwagger', () => { }); it('unknown type', () => { - expect(zodTypeToSwagger(unknown())).toEqual({}); + expect(zodTypeToSwagger(unknown())).toEqual({ example: {} }); }); it('native enum type', () => { diff --git a/packages/core/src/utils/zod.ts b/packages/core/src/utils/zod.ts index 5f8627433..3900c26fb 100644 --- a/packages/core/src/utils/zod.ts +++ b/packages/core/src/utils/zod.ts @@ -42,7 +42,7 @@ export const zodTypeToSwagger = (config: unknown): OpenAPIV3.SchemaObject => { } if (config instanceof ZodUnknown) { - return {}; // Any data type + return { example: {} }; // Any data type } if (config instanceof ZodObject) {