From a328c309ba30c2b782269eed31142ec5716d7e28 Mon Sep 17 00:00:00 2001 From: samchungy Date: Tue, 24 Sep 2024 14:56:20 +1000 Subject: [PATCH] fix import --- src/create/schema/single.test.ts | 18 ++++++++++++++++++ src/create/schema/single.ts | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/create/schema/single.test.ts b/src/create/schema/single.test.ts index fdfb58e..bae5893 100644 --- a/src/create/schema/single.test.ts +++ b/src/create/schema/single.test.ts @@ -15,6 +15,24 @@ describe('createSchema', () => { }); }); + it('should create a registered schema', () => { + const schema = createSchema( + z.string().openapi({ description: 'foo', ref: 'String' }), + ); + + expect(schema).toEqual({ + schema: { + $ref: '#/components/schemas/String', + }, + components: { + String: { + type: 'string', + description: 'foo', + }, + }, + }); + }); + it('should create components', () => { const schema = createSchema( z.object({ diff --git a/src/create/schema/single.ts b/src/create/schema/single.ts index b6f3b90..5d01431 100644 --- a/src/create/schema/single.ts +++ b/src/create/schema/single.ts @@ -1,7 +1,7 @@ import type { ZodType } from 'zod'; -import type { oas30, oas31 } from '../../../dist'; import type { OpenApiVersion } from '../../openapi'; +import type { oas30, oas31 } from '../../openapi3-ts/dist'; import { type CreationType, createSchemaComponents,