forked from loafle/openapi-generator-original
[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:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user