From 7eb045c22d8634ae23dede9f081729682a0cece7 Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Thu, 1 Feb 2024 11:46:48 -0500 Subject: [PATCH] Additional properties should add to a basic type as opposed to replacing it with a Record type --- package.json | 2 +- test/__snapshots__/index.spec.ts.snap | 4 +++- test/spec/v3.json | 7 ++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 14985fe6e..a01011b3f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nicolas-chaulet/openapi-typescript-codegen", - "version": "0.27.2", + "version": "0.27.3", "description": "Library that generates Typescript clients based on the OpenAPI specification.", "author": "Ferdi Koomen", "homepage": "https://github.com/CanoaPBC/openapi-typescript-codegen", diff --git a/test/__snapshots__/index.spec.ts.snap b/test/__snapshots__/index.spec.ts.snap index d86e8a7ac..4ff639127 100644 --- a/test/__snapshots__/index.spec.ts.snap +++ b/test/__snapshots__/index.spec.ts.snap @@ -4565,7 +4565,9 @@ exports[`v3 should generate: test/generated/v3/models/FreeFormObjectWithAddition /** * This is a free-form object with additionalProperties: true. */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = Record; +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + foo?: string; +} & Record; " `; diff --git a/test/spec/v3.json b/test/spec/v3.json index c901a6526..346f1a7b0 100644 --- a/test/spec/v3.json +++ b/test/spec/v3.json @@ -2712,7 +2712,12 @@ "FreeFormObjectWithAdditionalPropertiesEqTrue": { "description": "This is a free-form object with additionalProperties: true.", "type": "object", - "additionalProperties": true + "additionalProperties": true, + "properties": { + "foo": { + "type": "string" + } + } }, "FreeFormObjectWithAdditionalPropertiesEqEmptyObject": { "description": "This is a free-form object with additionalProperties: {}.",