From 5be6e7940460aa6bc7f9bf3708e2e154d5e267ee Mon Sep 17 00:00:00 2001 From: Dan Leehr Date: Wed, 23 Aug 2023 09:29:55 -0400 Subject: [PATCH] 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); }