From 613cf5189c4c4750f259f4ec9f2ae87d4f83b833 Mon Sep 17 00:00:00 2001 From: Aryaman Dhingra Date: Thu, 1 Aug 2024 10:54:28 -0400 Subject: [PATCH] test: add privateObject to private field test DX-613 --- .../openapi-generator/test/openapi.test.ts | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/packages/openapi-generator/test/openapi.test.ts b/packages/openapi-generator/test/openapi.test.ts index bf7e1b7d..750db329 100644 --- a/packages/openapi-generator/test/openapi.test.ts +++ b/packages/openapi-generator/test/openapi.test.ts @@ -3942,7 +3942,11 @@ import * as h from '@api-ts/io-ts-http'; const SampleType = t.type({ foo: t.string, /** @private */ - bar: t.string, // This should show up with x-internal + bar: t.string, // This should show up with x-internal, + /** @private */ + privateObject: t.type({ + privateFieldInObject: t.boolean + }) }); export const route = h.httpRoute({ @@ -3963,7 +3967,7 @@ export const route = h.httpRoute({ 200: SampleType }, }); -` +`; testCase("route with private properties in request query, params, body, and response", ROUTE_WITH_PRIVATE_PROPERTIES, { openapi: "3.0.3", @@ -4007,11 +4011,24 @@ testCase("route with private properties in request query, params, body, and resp }, foo: { type: 'string' + }, + privateObject: { + 'x-internal': true, + properties: { + privateFieldInObject: { + type: 'boolean' + } + }, + required: [ + 'privateFieldInObject' + ], + type: 'object' } }, required: [ 'foo', - 'bar' + 'bar', + 'privateObject' ], type: 'object' } @@ -4043,11 +4060,24 @@ testCase("route with private properties in request query, params, body, and resp }, foo: { type: 'string' + }, + privateObject: { + 'x-internal': true, + properties: { + privateFieldInObject: { + type: 'boolean' + } + }, + required: [ + 'privateFieldInObject' + ], + type: 'object' } }, required: [ 'foo', - 'bar' + 'bar', + 'privateObject' ], title: 'SampleType', type: 'object'