diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache
index 019b3f3e7c0c..c045f6241e25 100644
--- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache
@@ -279,7 +279,7 @@ export class {{classname}} extends runtime.BaseAPI {
{{^isEnumRef}}
{{^withoutRuntimeChecks}}
{{^isContainer}}
- formParams.append('{{baseName}}', new Blob([JSON.stringify({{{dataType}}}ToJSON(requestParameters['{{paramName}}']))], { type: "application/json", }));
+ formParams.append('{{baseName}}', new Blob([JSON.stringify({{#isFreeFormObject}}runtime.anyToJSON{{/isFreeFormObject}}{{^isFreeFormObject}}{{{dataType}}}ToJSON{{/isFreeFormObject}}(requestParameters['{{paramName}}']))], { type: "application/json", }));
{{/isContainer}}
{{#isContainer}}
formParams.append('{{baseName}}', new Blob([JSON.stringify(requestParameters['{{paramName}}'])], { type: "application/json", }));
diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache
index 88574cad021d..235458a2df2f 100644
--- a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache
@@ -357,6 +357,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
}
return result;
}
+
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
{{/withoutRuntimeChecks}}
export function canConsumeForm(consumes: Consume[]): boolean {
diff --git a/modules/openapi-generator/src/test/resources/3_0/typescript-fetch/any_type_property.json b/modules/openapi-generator/src/test/resources/3_0/typescript-fetch/any_type_property.json
new file mode 100644
index 000000000000..8c0b6ba23921
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_0/typescript-fetch/any_type_property.json
@@ -0,0 +1,39 @@
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "Any Type Property Test",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/upload": {
+ "post": {
+ "operationId": "uploadFile",
+ "tags": ["Upload"],
+ "requestBody": {
+ "content": {
+ "application/x-www-form-urlencoded": {
+ "schema": {
+ "type": "object",
+ "required": ["name"],
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "file": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success"
+ }
+ }
+ }
+ }
+ },
+ "components": {}
+}
diff --git a/samples/client/others/typescript-fetch/additional-properties-in-multipart-issue/runtime.ts b/samples/client/others/typescript-fetch/additional-properties-in-multipart-issue/runtime.ts
index 5ff28bda9b85..cc66cbfbb3af 100644
--- a/samples/client/others/typescript-fetch/additional-properties-in-multipart-issue/runtime.ts
+++ b/samples/client/others/typescript-fetch/additional-properties-in-multipart-issue/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/others/typescript-fetch/infinite-recursion-issue/runtime.ts b/samples/client/others/typescript-fetch/infinite-recursion-issue/runtime.ts
index 5ff28bda9b85..cc66cbfbb3af 100644
--- a/samples/client/others/typescript-fetch/infinite-recursion-issue/runtime.ts
+++ b/samples/client/others/typescript-fetch/infinite-recursion-issue/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/others/typescript-fetch/multipart-file-array/runtime.ts b/samples/client/others/typescript-fetch/multipart-file-array/runtime.ts
index efa9707fc9dd..a49c6563b888 100644
--- a/samples/client/others/typescript-fetch/multipart-file-array/runtime.ts
+++ b/samples/client/others/typescript-fetch/multipart-file-array/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/others/typescript-fetch/self-import-issue/runtime.ts b/samples/client/others/typescript-fetch/self-import-issue/runtime.ts
index 0fdb285eb3e3..8aa237368f4f 100644
--- a/samples/client/others/typescript-fetch/self-import-issue/runtime.ts
+++ b/samples/client/others/typescript-fetch/self-import-issue/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts
index d026886681df..a9a8ee84339c 100644
--- a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts
index d026886681df..a9a8ee84339c 100644
--- a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts
index a37b33ee1f0c..e52a36947b03 100644
--- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts
index 54253e345bd3..3389e4beb1cc 100644
--- a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts b/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts
index b21f204f79d0..2d2f267ce4a8 100644
--- a/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts
index 54253e345bd3..3389e4beb1cc 100644
--- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/kebab-case/runtime.ts b/samples/client/petstore/typescript-fetch/builds/kebab-case/runtime.ts
index a37b33ee1f0c..e52a36947b03 100644
--- a/samples/client/petstore/typescript-fetch/builds/kebab-case/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/kebab-case/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts
index 54253e345bd3..3389e4beb1cc 100644
--- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/oneOf/runtime.ts b/samples/client/petstore/typescript-fetch/builds/oneOf/runtime.ts
index b6e077dfda49..8c8a505df958 100644
--- a/samples/client/petstore/typescript-fetch/builds/oneOf/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/oneOf/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts
index 54253e345bd3..3389e4beb1cc 100644
--- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts
index 54253e345bd3..3389e4beb1cc 100644
--- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts
index a37b33ee1f0c..e52a36947b03 100644
--- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/runtime.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/runtime.ts
index 54253e345bd3..3389e4beb1cc 100644
--- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts
index 54253e345bd3..3389e4beb1cc 100644
--- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts
index 54253e345bd3..3389e4beb1cc 100644
--- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts
index b21f204f79d0..2d2f267ce4a8 100644
--- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts
+++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts
@@ -367,6 +367,11 @@ export function mapValues(data: any, fn: (item: any) => any) {
return result;
}
+// Pass-through serializer for `any`-typed properties in form data. See #1877.
+export function anyToJSON(value: any): any {
+ return value;
+}
+
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if (consume.contentType?.startsWith('multipart/form-data') == true) {
diff --git a/samples/server/petstore/jaxrs-spec-enum/pom.xml b/samples/server/petstore/jaxrs-spec-enum/pom.xml
index 6d963d6dc72a..6f8ea7bbc4d2 100644
--- a/samples/server/petstore/jaxrs-spec-enum/pom.xml
+++ b/samples/server/petstore/jaxrs-spec-enum/pom.xml
@@ -37,9 +37,13 @@
false
+
+ maven-surefire-plugin
+ 3.5.6
+
maven-failsafe-plugin
- 2.6
+ 3.5.6
@@ -91,8 +95,8 @@
3.0.2
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-engine
${junit-version}
test
@@ -135,7 +139,7 @@
${java.version}
UTF-8
2.19.2
- 4.13.2
+ 5.14.4
2.10.13
1.3.2
2.0.2