From 48821de78a2c676a5ee64f24a88fbc7f73f9110b Mon Sep 17 00:00:00 2001 From: Patrick McLaughlin Date: Thu, 9 May 2024 10:52:55 -0400 Subject: [PATCH] fix: don't silently drop properties from httpRequest --- packages/openapi-generator/src/knownImports.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/openapi-generator/src/knownImports.ts b/packages/openapi-generator/src/knownImports.ts index 6ba3f7c6..cd1bae50 100644 --- a/packages/openapi-generator/src/knownImports.ts +++ b/packages/openapi-generator/src/knownImports.ts @@ -206,13 +206,14 @@ export const KNOWN_IMPORTS: KnownImports = { if (schema.type !== 'object') { return E.left('httpRoute parameter must be object'); } - const props = Object.entries(schema.properties).reduce((acc, [key, prop]) => { - const derefedE = deref(prop); + const props: Record = {}; + for (const [key, value] of Object.entries(schema.properties)) { + const derefedE = deref(value); if (E.isLeft(derefedE)) { - return acc; + return derefedE; } - return { ...acc, [key]: derefedE.right }; - }, {}); + props[key] = derefedE.right; + } return E.right({ type: 'object', properties: props,