From a49c50ac3986915a3017325b6a4bd44f222d7519 Mon Sep 17 00:00:00 2001 From: James Berry Date: Wed, 24 May 2023 12:10:58 +0700 Subject: [PATCH] test/with-deprecated --- test/generator.test.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/generator.test.ts b/test/generator.test.ts index ba30cbe7..0f6a0421 100644 --- a/test/generator.test.ts +++ b/test/generator.test.ts @@ -2568,7 +2568,7 @@ describe('generator', () => { (openApiDocument.paths['/with-all']!.post!.requestBody as any).content['application/json'], ).toEqual( (openApiDocument.paths['/with-all']!.post!.requestBody as any).content[ - 'application/x-www-form-urlencoded' + 'application/x-www-form-urlencoded' ], ); expect( @@ -2577,6 +2577,21 @@ describe('generator', () => { } }); + test('with deprecated', () => { + const appRouter = t.router({ + deprecated: t.procedure + .meta({ openapi: { method: 'POST', path: '/deprecated', deprecated: true } }) + .input(z.object({ payload: z.string() })) + .output(z.object({ payload: z.string() })) + .mutation(({ input }) => ({ payload: input.payload })), + }); + + const openApiDocument = generateOpenApiDocument(appRouter, defaultDocOpts); + + expect(openApiSchemaValidator.validate(openApiDocument).errors).toEqual([]); + expect(openApiDocument.paths['/deprecated']!.post!.deprecated).toEqual(true); + }); + test('with security schemes', () => { const appRouter = t.router({});