[Typescript] Support text/plain by ObjectSerializer.stringify (#12799)

* [Typescript] Support text/plain by ObjectSerializer.stringify

* Update ObjectSerializer.mustache

* Update ObjectSerializer.mustache

* Update ObjectSerializer.ts

* generate samples

* generate samples

* update samples, remove trailing spaces

* Update modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache

Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>

* regenerate samples

* update samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>
Co-authored-by: Esteban Gehring <esteban.gehring@bithost.ch>
This commit is contained in:
Ruben Fiszel
2022-07-15 11:35:34 +02:00
committed by GitHub
parent f830adac5b
commit 810a8b5937
9 changed files with 36 additions and 0 deletions

View File

@@ -225,6 +225,10 @@ export class ObjectSerializer {
* Convert data to a string according the given media type
*/
public static stringify(data: any, mediaType: string): string {
if (mediaType === "text/plain") {
return String(data);
}
if (mediaType === "application/json") {
return JSON.stringify(data);
}

View File

@@ -197,6 +197,10 @@ export class ObjectSerializer {
* Convert data to a string according the given media type
*/
public static stringify(data: any, mediaType: string): string {
if (mediaType === "text/plain") {
return String(data);
}
if (mediaType === "application/json") {
return JSON.stringify(data);
}

View File

@@ -214,6 +214,10 @@ export class ObjectSerializer {
* Convert data to a string according the given media type
*/
public static stringify(data: any, mediaType: string): string {
if (mediaType === "text/plain") {
return String(data);
}
if (mediaType === "application/json") {
return JSON.stringify(data);
}

View File

@@ -226,6 +226,10 @@ export class ObjectSerializer {
* Convert data to a string according the given media type
*/
public static stringify(data: any, mediaType: string): string {
if (mediaType === "text/plain") {
return String(data);
}
if (mediaType === "application/json") {
return JSON.stringify(data);
}

View File

@@ -214,6 +214,10 @@ export class ObjectSerializer {
* Convert data to a string according the given media type
*/
public static stringify(data: any, mediaType: string): string {
if (mediaType === "text/plain") {
return String(data);
}
if (mediaType === "application/json") {
return JSON.stringify(data);
}

View File

@@ -214,6 +214,10 @@ export class ObjectSerializer {
* Convert data to a string according the given media type
*/
public static stringify(data: any, mediaType: string): string {
if (mediaType === "text/plain") {
return String(data);
}
if (mediaType === "application/json") {
return JSON.stringify(data);
}

View File

@@ -214,6 +214,10 @@ export class ObjectSerializer {
* Convert data to a string according the given media type
*/
public static stringify(data: any, mediaType: string): string {
if (mediaType === "text/plain") {
return String(data);
}
if (mediaType === "application/json") {
return JSON.stringify(data);
}

View File

@@ -214,6 +214,10 @@ export class ObjectSerializer {
* Convert data to a string according the given media type
*/
public static stringify(data: any, mediaType: string): string {
if (mediaType === "text/plain") {
return String(data);
}
if (mediaType === "application/json") {
return JSON.stringify(data);
}

View File

@@ -214,6 +214,10 @@ export class ObjectSerializer {
* Convert data to a string according the given media type
*/
public static stringify(data: any, mediaType: string): string {
if (mediaType === "text/plain") {
return String(data);
}
if (mediaType === "application/json") {
return JSON.stringify(data);
}