From 5be6e7940460aa6bc7f9bf3708e2e154d5e267ee Mon Sep 17 00:00:00 2001 From: Dan Leehr Date: Wed, 23 Aug 2023 09:29:55 -0400 Subject: [PATCH 1/2] Add supportedMediaTypes needed for kubernetes client https://github.com/kubernetes-client/javascript/issues/893 --- .../resources/typescript/model/ObjectSerializer.mustache | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache b/modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache index e208ed076120..d4cc5ce27ed1 100644 --- a/modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache @@ -24,6 +24,9 @@ let primitives = [ const supportedMediaTypes: { [mediaType: string]: number } = { "application/json": Infinity, + "application/json-patch+json": 1, + "application/merge-patch+json": 1, + "application/strategic-merge-patch+json": 1, "application/octet-stream": 0, "application/x-www-form-urlencoded": 0 } @@ -225,7 +228,7 @@ export class ObjectSerializer { return String(data); } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.stringify(data); } @@ -244,7 +247,7 @@ export class ObjectSerializer { return rawData; } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.parse(rawData); } From 9ca8aab944a50e9f22a1d06a0c8b2db27e036793 Mon Sep 17 00:00:00 2001 From: Dan Leehr Date: Wed, 23 Aug 2023 09:52:30 -0400 Subject: [PATCH 2/2] Add generated files --- .../builds/with-unique-items/models/ObjectSerializer.ts | 7 +++++-- .../typescript/builds/browser/models/ObjectSerializer.ts | 7 +++++-- .../builds/composed-schemas/models/ObjectSerializer.ts | 7 +++++-- .../typescript/builds/default/models/ObjectSerializer.ts | 7 +++++-- .../typescript/builds/deno/models/ObjectSerializer.ts | 7 +++++-- .../typescript/builds/inversify/models/ObjectSerializer.ts | 7 +++++-- .../typescript/builds/jquery/models/ObjectSerializer.ts | 7 +++++-- .../builds/object_params/models/ObjectSerializer.ts | 7 +++++-- 8 files changed, 40 insertions(+), 16 deletions(-) diff --git a/samples/client/others/typescript/builds/with-unique-items/models/ObjectSerializer.ts b/samples/client/others/typescript/builds/with-unique-items/models/ObjectSerializer.ts index 9961638ce229..6d4db8b98668 100644 --- a/samples/client/others/typescript/builds/with-unique-items/models/ObjectSerializer.ts +++ b/samples/client/others/typescript/builds/with-unique-items/models/ObjectSerializer.ts @@ -16,6 +16,9 @@ let primitives = [ const supportedMediaTypes: { [mediaType: string]: number } = { "application/json": Infinity, + "application/json-patch+json": 1, + "application/merge-patch+json": 1, + "application/strategic-merge-patch+json": 1, "application/octet-stream": 0, "application/x-www-form-urlencoded": 0 } @@ -197,7 +200,7 @@ export class ObjectSerializer { return String(data); } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.stringify(data); } @@ -216,7 +219,7 @@ export class ObjectSerializer { return rawData; } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.parse(rawData); } diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/browser/models/ObjectSerializer.ts index c2f808acfe5d..d93655eca068 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/models/ObjectSerializer.ts @@ -26,6 +26,9 @@ let primitives = [ const supportedMediaTypes: { [mediaType: string]: number } = { "application/json": Infinity, + "application/json-patch+json": 1, + "application/merge-patch+json": 1, + "application/strategic-merge-patch+json": 1, "application/octet-stream": 0, "application/x-www-form-urlencoded": 0 } @@ -214,7 +217,7 @@ export class ObjectSerializer { return String(data); } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.stringify(data); } @@ -233,7 +236,7 @@ export class ObjectSerializer { return rawData; } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.parse(rawData); } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/ObjectSerializer.ts index 42ea776f16cf..b1beacef71f0 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/ObjectSerializer.ts @@ -28,6 +28,9 @@ let primitives = [ const supportedMediaTypes: { [mediaType: string]: number } = { "application/json": Infinity, + "application/json-patch+json": 1, + "application/merge-patch+json": 1, + "application/strategic-merge-patch+json": 1, "application/octet-stream": 0, "application/x-www-form-urlencoded": 0 } @@ -219,7 +222,7 @@ export class ObjectSerializer { return String(data); } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.stringify(data); } @@ -238,7 +241,7 @@ export class ObjectSerializer { return rawData; } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.parse(rawData); } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/default/models/ObjectSerializer.ts index c2f808acfe5d..d93655eca068 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/models/ObjectSerializer.ts @@ -26,6 +26,9 @@ let primitives = [ const supportedMediaTypes: { [mediaType: string]: number } = { "application/json": Infinity, + "application/json-patch+json": 1, + "application/merge-patch+json": 1, + "application/strategic-merge-patch+json": 1, "application/octet-stream": 0, "application/x-www-form-urlencoded": 0 } @@ -214,7 +217,7 @@ export class ObjectSerializer { return String(data); } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.stringify(data); } @@ -233,7 +236,7 @@ export class ObjectSerializer { return rawData; } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.parse(rawData); } diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/deno/models/ObjectSerializer.ts index fb17977f530d..1fff95395cd9 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/models/ObjectSerializer.ts @@ -26,6 +26,9 @@ let primitives = [ const supportedMediaTypes: { [mediaType: string]: number } = { "application/json": Infinity, + "application/json-patch+json": 1, + "application/merge-patch+json": 1, + "application/strategic-merge-patch+json": 1, "application/octet-stream": 0, "application/x-www-form-urlencoded": 0 } @@ -214,7 +217,7 @@ export class ObjectSerializer { return String(data); } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.stringify(data); } @@ -233,7 +236,7 @@ export class ObjectSerializer { return rawData; } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.parse(rawData); } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/models/ObjectSerializer.ts index c2f808acfe5d..d93655eca068 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/models/ObjectSerializer.ts @@ -26,6 +26,9 @@ let primitives = [ const supportedMediaTypes: { [mediaType: string]: number } = { "application/json": Infinity, + "application/json-patch+json": 1, + "application/merge-patch+json": 1, + "application/strategic-merge-patch+json": 1, "application/octet-stream": 0, "application/x-www-form-urlencoded": 0 } @@ -214,7 +217,7 @@ export class ObjectSerializer { return String(data); } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.stringify(data); } @@ -233,7 +236,7 @@ export class ObjectSerializer { return rawData; } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.parse(rawData); } diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts index c2f808acfe5d..d93655eca068 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/models/ObjectSerializer.ts @@ -26,6 +26,9 @@ let primitives = [ const supportedMediaTypes: { [mediaType: string]: number } = { "application/json": Infinity, + "application/json-patch+json": 1, + "application/merge-patch+json": 1, + "application/strategic-merge-patch+json": 1, "application/octet-stream": 0, "application/x-www-form-urlencoded": 0 } @@ -214,7 +217,7 @@ export class ObjectSerializer { return String(data); } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.stringify(data); } @@ -233,7 +236,7 @@ export class ObjectSerializer { return rawData; } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.parse(rawData); } diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/models/ObjectSerializer.ts index c2f808acfe5d..d93655eca068 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/models/ObjectSerializer.ts @@ -26,6 +26,9 @@ let primitives = [ const supportedMediaTypes: { [mediaType: string]: number } = { "application/json": Infinity, + "application/json-patch+json": 1, + "application/merge-patch+json": 1, + "application/strategic-merge-patch+json": 1, "application/octet-stream": 0, "application/x-www-form-urlencoded": 0 } @@ -214,7 +217,7 @@ export class ObjectSerializer { return String(data); } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.stringify(data); } @@ -233,7 +236,7 @@ export class ObjectSerializer { return rawData; } - if (mediaType === "application/json") { + if (mediaType === "application/json" || mediaType === "application/json-patch+json" || mediaType === "application/merge-patch+json" || mediaType === "application/strategic-merge-patch+json") { return JSON.parse(rawData); }