diff --git a/src/schema-routes/schema-routes.ts b/src/schema-routes/schema-routes.ts index b8bf8f24..cf35e98d 100644 --- a/src/schema-routes/schema-routes.ts +++ b/src/schema-routes/schema-routes.ts @@ -22,6 +22,7 @@ import { SpecificArgNameResolver } from "./util/specific-arg-name-resolver.js"; const CONTENT_KIND = { JSON: "JSON", + JSON_API: "JSON_API", URL_ENCODED: "URL_ENCODED", FORM_DATA: "FORM_DATA", IMAGE: "IMAGE", @@ -280,6 +281,10 @@ export class SchemaRoutes { ); getContentKind = (contentTypes) => { + if (contentTypes.includes("application/vnd.api+json")) { + return CONTENT_KIND.JSON_API; + } + if ( contentTypes.some((contentType) => contentType.startsWith("application/json"), diff --git a/templates/base/http-clients/axios-http-client.ejs b/templates/base/http-clients/axios-http-client.ejs index 0b0a9ecb..bc77f346 100644 --- a/templates/base/http-clients/axios-http-client.ejs +++ b/templates/base/http-clients/axios-http-client.ejs @@ -32,6 +32,7 @@ export interface ApiConfig extends Omit { private contentFormatters: Record any> = { [ContentType.Json]: (input:any) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input:any) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, [ContentType.Text]: (input:any) => input !== null && typeof input !== "string" ? JSON.stringify(input) : input, [ContentType.FormData]: (input: any) => Object.keys(input || {}).reduce((formData, key) => { diff --git a/templates/default/procedure-call.ejs b/templates/default/procedure-call.ejs index 465d6327..426aba34 100644 --- a/templates/default/procedure-call.ejs +++ b/templates/default/procedure-call.ejs @@ -48,6 +48,7 @@ const wrapperArgs = _ // RequestParams["type"] const requestContentKind = { "JSON": "ContentType.Json", + "JSON_API": "ContentType.JsonApi", "URL_ENCODED": "ContentType.UrlEncoded", "FORM_DATA": "ContentType.FormData", "TEXT": "ContentType.Text", diff --git a/templates/modular/procedure-call.ejs b/templates/modular/procedure-call.ejs index 6f15500f..1af59ac8 100644 --- a/templates/modular/procedure-call.ejs +++ b/templates/modular/procedure-call.ejs @@ -48,6 +48,7 @@ const wrapperArgs = _ // RequestParams["type"] const requestContentKind = { "JSON": "ContentType.Json", + "JSON_API": "ContentType.JsonApi", "URL_ENCODED": "ContentType.UrlEncoded", "FORM_DATA": "ContentType.FormData", "TEXT": "ContentType.Text", diff --git a/tests/__snapshots__/extended.test.ts.snap b/tests/__snapshots__/extended.test.ts.snap index 9408c5ae..c3b7c196 100644 --- a/tests/__snapshots__/extended.test.ts.snap +++ b/tests/__snapshots__/extended.test.ts.snap @@ -2397,6 +2397,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -2463,6 +2464,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -4411,6 +4416,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -4477,6 +4483,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -4682,6 +4692,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -4748,6 +4759,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -4988,6 +5003,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -5054,6 +5070,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -5933,6 +5953,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -5999,6 +6020,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -6718,6 +6743,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -6784,6 +6810,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -7067,6 +7097,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -7133,6 +7164,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -7374,6 +7409,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -7440,6 +7476,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -7729,6 +7769,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -7795,6 +7836,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -8531,6 +8576,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -8597,6 +8643,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -9117,6 +9167,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -9183,6 +9234,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -9423,6 +9478,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -9489,6 +9545,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -9771,6 +9831,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -9837,6 +9898,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -10114,6 +10179,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -10180,6 +10246,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -10478,6 +10548,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -10544,6 +10615,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -10814,6 +10889,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -10880,6 +10956,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -46359,6 +46439,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -46425,6 +46506,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -62045,6 +62130,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -62111,6 +62197,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -63062,6 +63152,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -63128,6 +63219,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -63680,6 +63775,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -63746,6 +63842,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -64064,6 +64164,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -64130,6 +64231,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -64367,6 +64472,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -64433,6 +64539,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -64718,6 +64828,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -64784,6 +64895,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -65401,6 +65516,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -65467,6 +65583,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -65964,6 +66084,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -66030,6 +66151,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -66374,6 +66499,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -66440,6 +66566,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -66809,6 +66939,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -66875,6 +67006,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -67298,6 +67433,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -67364,6 +67500,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -67674,6 +67814,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -67740,6 +67881,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -68087,6 +68232,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -68153,6 +68299,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -68939,6 +69089,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -69005,6 +69156,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -69699,6 +69854,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -69765,6 +69921,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -70077,6 +70237,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -70143,6 +70304,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -70379,6 +70544,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -70445,6 +70611,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -70664,6 +70834,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -70730,6 +70901,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -70986,6 +71161,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -71053,6 +71229,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -71695,6 +71875,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -71761,6 +71942,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -72569,6 +72754,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -72635,6 +72821,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -74320,6 +74510,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -74386,6 +74577,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -75046,6 +75241,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -75112,6 +75308,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -75388,6 +75588,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -75454,6 +75655,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -75809,6 +76014,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -75875,6 +76081,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/__snapshots__/simple.test.ts.snap b/tests/__snapshots__/simple.test.ts.snap index 5b8aa61a..47478cb0 100644 --- a/tests/__snapshots__/simple.test.ts.snap +++ b/tests/__snapshots__/simple.test.ts.snap @@ -216,6 +216,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -282,6 +283,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -2557,6 +2562,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -2623,6 +2629,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -2828,6 +2838,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -2894,6 +2905,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -3108,6 +3123,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -3174,6 +3190,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -3525,6 +3545,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -3591,6 +3612,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -4285,6 +4310,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -4351,6 +4377,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -4616,6 +4646,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -4682,6 +4713,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -4903,6 +4938,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -4969,6 +5005,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -5202,6 +5242,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -5268,6 +5309,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -5575,6 +5620,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -5641,6 +5687,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -6219,6 +6269,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -6285,6 +6336,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -6523,6 +6578,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -6589,6 +6645,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -6871,6 +6931,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -6937,6 +6998,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -7175,6 +7240,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -7241,6 +7307,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -7493,6 +7563,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -7559,6 +7630,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -7809,6 +7884,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -7875,6 +7951,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -16770,6 +16850,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -16836,6 +16917,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -37896,6 +37981,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -37962,6 +38048,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -38461,6 +38551,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -38527,6 +38618,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -39137,6 +39232,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -39203,6 +39299,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -39525,6 +39625,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -39591,6 +39692,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -39802,6 +39907,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -39868,6 +39974,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -40086,6 +40196,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -40152,6 +40263,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -40571,6 +40686,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -40637,6 +40753,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -41058,6 +41178,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -41124,6 +41245,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -41401,6 +41526,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -41467,6 +41593,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -41745,6 +41875,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -41811,6 +41942,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -42125,6 +42260,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -42191,6 +42327,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -42495,6 +42635,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -42561,6 +42702,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -42808,6 +42953,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -42874,6 +43020,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -43213,6 +43363,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -43279,6 +43430,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -43894,6 +44049,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -43960,6 +44116,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -44239,6 +44399,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -44305,6 +44466,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -44548,6 +44713,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -44614,6 +44780,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -44814,6 +44984,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -44880,6 +45051,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -45104,6 +45279,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -45171,6 +45347,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -45519,6 +45699,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -45585,6 +45766,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -46159,6 +46344,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -46225,6 +46411,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -47335,6 +47525,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -47401,6 +47592,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -48117,6 +48312,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -48183,6 +48379,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -48471,6 +48671,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -48537,6 +48738,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) @@ -48762,6 +48967,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -48828,6 +49034,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/another-query-params/__snapshots__/basic.test.ts.snap b/tests/spec/another-query-params/__snapshots__/basic.test.ts.snap index 7319b5a4..9598b39d 100644 --- a/tests/spec/another-query-params/__snapshots__/basic.test.ts.snap +++ b/tests/spec/another-query-params/__snapshots__/basic.test.ts.snap @@ -87,6 +87,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -153,6 +154,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/axios/__snapshots__/basic.test.ts.snap b/tests/spec/axios/__snapshots__/basic.test.ts.snap index b67816fe..ba768ef9 100644 --- a/tests/spec/axios/__snapshots__/basic.test.ts.snap +++ b/tests/spec/axios/__snapshots__/basic.test.ts.snap @@ -1954,6 +1954,7 @@ export interface ApiConfig export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", diff --git a/tests/spec/axiosSingleHttpClient/__snapshots__/basic.test.ts.snap b/tests/spec/axiosSingleHttpClient/__snapshots__/basic.test.ts.snap index 4ccdd2bd..ca053dec 100644 --- a/tests/spec/axiosSingleHttpClient/__snapshots__/basic.test.ts.snap +++ b/tests/spec/axiosSingleHttpClient/__snapshots__/basic.test.ts.snap @@ -1954,6 +1954,7 @@ export interface ApiConfig export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", diff --git a/tests/spec/custom-extensions/__snapshots__/basic.test.ts.snap b/tests/spec/custom-extensions/__snapshots__/basic.test.ts.snap index 9e90641f..4e61612d 100644 --- a/tests/spec/custom-extensions/__snapshots__/basic.test.ts.snap +++ b/tests/spec/custom-extensions/__snapshots__/basic.test.ts.snap @@ -59,6 +59,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -125,6 +126,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/defaultAsSuccess/__snapshots__/basic.test.ts.snap b/tests/spec/defaultAsSuccess/__snapshots__/basic.test.ts.snap index b8d60d05..b5f75e01 100644 --- a/tests/spec/defaultAsSuccess/__snapshots__/basic.test.ts.snap +++ b/tests/spec/defaultAsSuccess/__snapshots__/basic.test.ts.snap @@ -99,6 +99,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -165,6 +166,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/defaultResponse/__snapshots__/basic.test.ts.snap b/tests/spec/defaultResponse/__snapshots__/basic.test.ts.snap index 2371e64c..6f3645e8 100644 --- a/tests/spec/defaultResponse/__snapshots__/basic.test.ts.snap +++ b/tests/spec/defaultResponse/__snapshots__/basic.test.ts.snap @@ -59,6 +59,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -125,6 +126,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/deprecated/__snapshots__/basic.test.ts.snap b/tests/spec/deprecated/__snapshots__/basic.test.ts.snap index 745c29a3..dc098293 100644 --- a/tests/spec/deprecated/__snapshots__/basic.test.ts.snap +++ b/tests/spec/deprecated/__snapshots__/basic.test.ts.snap @@ -59,6 +59,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -125,6 +126,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/dot-path-params/__snapshots__/basic.test.ts.snap b/tests/spec/dot-path-params/__snapshots__/basic.test.ts.snap index a19e7f6e..b76be01b 100644 --- a/tests/spec/dot-path-params/__snapshots__/basic.test.ts.snap +++ b/tests/spec/dot-path-params/__snapshots__/basic.test.ts.snap @@ -61,6 +61,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -127,6 +128,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/enumNamesAsValues/__snapshots__/basic.test.ts.snap b/tests/spec/enumNamesAsValues/__snapshots__/basic.test.ts.snap index 578ced2f..fe32e763 100644 --- a/tests/spec/enumNamesAsValues/__snapshots__/basic.test.ts.snap +++ b/tests/spec/enumNamesAsValues/__snapshots__/basic.test.ts.snap @@ -251,6 +251,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -317,6 +318,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/enumNotFirstInComponents/__snapshots__/basic.test.ts.snap b/tests/spec/enumNotFirstInComponents/__snapshots__/basic.test.ts.snap index 3a69d716..c29e1c88 100644 --- a/tests/spec/enumNotFirstInComponents/__snapshots__/basic.test.ts.snap +++ b/tests/spec/enumNotFirstInComponents/__snapshots__/basic.test.ts.snap @@ -89,6 +89,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -155,6 +156,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/extractRequestBody/__snapshots__/basic.test.ts.snap b/tests/spec/extractRequestBody/__snapshots__/basic.test.ts.snap index a0176cfe..b14d8a46 100644 --- a/tests/spec/extractRequestBody/__snapshots__/basic.test.ts.snap +++ b/tests/spec/extractRequestBody/__snapshots__/basic.test.ts.snap @@ -228,6 +228,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -294,6 +295,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/extractRequestParams/__snapshots__/basic.test.ts.snap b/tests/spec/extractRequestParams/__snapshots__/basic.test.ts.snap index d5b1f33e..186ea7f5 100644 --- a/tests/spec/extractRequestParams/__snapshots__/basic.test.ts.snap +++ b/tests/spec/extractRequestParams/__snapshots__/basic.test.ts.snap @@ -134,6 +134,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -200,6 +201,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/extractResponseBody/__snapshots__/basic.test.ts.snap b/tests/spec/extractResponseBody/__snapshots__/basic.test.ts.snap index 26afc69d..c2aa9c9c 100644 --- a/tests/spec/extractResponseBody/__snapshots__/basic.test.ts.snap +++ b/tests/spec/extractResponseBody/__snapshots__/basic.test.ts.snap @@ -214,6 +214,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -280,6 +281,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/extractResponseError/__snapshots__/basic.test.ts.snap b/tests/spec/extractResponseError/__snapshots__/basic.test.ts.snap index c62ce5e2..15e631b1 100644 --- a/tests/spec/extractResponseError/__snapshots__/basic.test.ts.snap +++ b/tests/spec/extractResponseError/__snapshots__/basic.test.ts.snap @@ -209,6 +209,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -275,6 +276,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/js/__snapshots__/basic.test.ts.snap b/tests/spec/js/__snapshots__/basic.test.ts.snap index d70bd7ec..019ed5c2 100644 --- a/tests/spec/js/__snapshots__/basic.test.ts.snap +++ b/tests/spec/js/__snapshots__/basic.test.ts.snap @@ -17,6 +17,7 @@ import axios from "axios"; export var ContentType; (function (ContentType) { ContentType["Json"] = "application/json"; + ContentType["JsonApi"] = "application/vnd.api+json"; ContentType["FormData"] = "multipart/form-data"; ContentType["UrlEncoded"] = "application/x-www-form-urlencoded"; ContentType["Text"] = "text/plain"; diff --git a/tests/spec/jsAxios/__snapshots__/basic.test.ts.snap b/tests/spec/jsAxios/__snapshots__/basic.test.ts.snap index 339665bc..a1e3fc78 100644 --- a/tests/spec/jsAxios/__snapshots__/basic.test.ts.snap +++ b/tests/spec/jsAxios/__snapshots__/basic.test.ts.snap @@ -16,6 +16,7 @@ exports[`basic > --js 1`] = ` export var ContentType; (function (ContentType) { ContentType["Json"] = "application/json"; + ContentType["JsonApi"] = "application/vnd.api+json"; ContentType["FormData"] = "multipart/form-data"; ContentType["UrlEncoded"] = "application/x-www-form-urlencoded"; ContentType["Text"] = "text/plain"; @@ -71,6 +72,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/jsonapi-media-type/__snapshots__/basic.test.ts.snap b/tests/spec/jsonapi-media-type/__snapshots__/basic.test.ts.snap new file mode 100644 index 00000000..05bfae3e --- /dev/null +++ b/tests/spec/jsonapi-media-type/__snapshots__/basic.test.ts.snap @@ -0,0 +1,351 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > jsonapi-media-type 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +// @ts-nocheck +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Pet { + /** @format uuid */ + id?: string; + type: "pet"; + attributes: { + name: string; + status?: "available" | "pending" | "sold"; + photoUrls: string[]; + }; +} + +export interface Error { + status?: string; + detail?: string; +} + +export type QueryParamsType = Record; +export type ResponseFormat = keyof Omit; + +export interface FullRequestParams extends Omit { + /** set parameter to \`true\` for call \`securityWorker\` for this request */ + secure?: boolean; + /** request path */ + path: string; + /** content type of request body */ + type?: ContentType; + /** query params */ + query?: QueryParamsType; + /** format of response (i.e. response.json() -> format: "json") */ + format?: ResponseFormat; + /** request body */ + body?: unknown; + /** base url */ + baseUrl?: string; + /** request cancellation token */ + cancelToken?: CancelToken; +} + +export type RequestParams = Omit< + FullRequestParams, + "body" | "method" | "query" | "path" +>; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: ( + securityData: SecurityDataType | null, + ) => Promise | RequestParams | void; + customFetch?: typeof fetch; +} + +export interface HttpResponse + extends Response { + data: D; + error: E; +} + +type CancelToken = Symbol | string | number; + +export enum ContentType { + Json = "application/json", + JsonApi = "application/vnd.api+json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", + Text = "text/plain", +} + +export class HttpClient { + public baseUrl: string = "https://api.petstore.localhost"; + private securityData: SecurityDataType | null = null; + private securityWorker?: ApiConfig["securityWorker"]; + private abortControllers = new Map(); + private customFetch = (...fetchParams: Parameters) => + fetch(...fetchParams); + + private baseApiParams: RequestParams = { + credentials: "same-origin", + headers: {}, + redirect: "follow", + referrerPolicy: "no-referrer", + }; + + constructor(apiConfig: ApiConfig = {}) { + Object.assign(this, apiConfig); + } + + public setSecurityData = (data: SecurityDataType | null) => { + this.securityData = data; + }; + + protected encodeQueryParam(key: string, value: any) { + const encodedKey = encodeURIComponent(key); + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; + } + + protected addQueryParam(query: QueryParamsType, key: string) { + return this.encodeQueryParam(key, query[key]); + } + + protected addArrayQueryParam(query: QueryParamsType, key: string) { + const value = query[key]; + return value.map((v: any) => this.encodeQueryParam(key, v)).join("&"); + } + + protected toQueryString(rawQuery?: QueryParamsType): string { + const query = rawQuery || {}; + const keys = Object.keys(query).filter( + (key) => "undefined" !== typeof query[key], + ); + return keys + .map((key) => + Array.isArray(query[key]) + ? this.addArrayQueryParam(query, key) + : this.addQueryParam(query, key), + ) + .join("&"); + } + + protected addQueryParams(rawQuery?: QueryParamsType): string { + const queryString = this.toQueryString(rawQuery); + return queryString ? \`?\${queryString}\` : ""; + } + + private contentFormatters: Record any> = { + [ContentType.Json]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, + [ContentType.Text]: (input: any) => + input !== null && typeof input !== "string" + ? JSON.stringify(input) + : input, + [ContentType.FormData]: (input: any) => + Object.keys(input || {}).reduce((formData, key) => { + const property = input[key]; + formData.append( + key, + property instanceof Blob + ? property + : typeof property === "object" && property !== null + ? JSON.stringify(property) + : \`\${property}\`, + ); + return formData; + }, new FormData()), + [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input), + }; + + protected mergeRequestParams( + params1: RequestParams, + params2?: RequestParams, + ): RequestParams { + return { + ...this.baseApiParams, + ...params1, + ...(params2 || {}), + headers: { + ...(this.baseApiParams.headers || {}), + ...(params1.headers || {}), + ...((params2 && params2.headers) || {}), + }, + }; + } + + protected createAbortSignal = ( + cancelToken: CancelToken, + ): AbortSignal | undefined => { + if (this.abortControllers.has(cancelToken)) { + const abortController = this.abortControllers.get(cancelToken); + if (abortController) { + return abortController.signal; + } + return void 0; + } + + const abortController = new AbortController(); + this.abortControllers.set(cancelToken, abortController); + return abortController.signal; + }; + + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); + + if (abortController) { + abortController.abort(); + this.abortControllers.delete(cancelToken); + } + }; + + public request = async ({ + body, + secure, + path, + type, + query, + format, + baseUrl, + cancelToken, + ...params + }: FullRequestParams): Promise> => { + const secureParams = + ((typeof secure === "boolean" ? secure : this.baseApiParams.secure) && + this.securityWorker && + (await this.securityWorker(this.securityData))) || + {}; + const requestParams = this.mergeRequestParams(params, secureParams); + const queryString = query && this.toQueryString(query); + const payloadFormatter = this.contentFormatters[type || ContentType.Json]; + const responseFormat = format || requestParams.format; + + return this.customFetch( + \`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, + { + ...requestParams, + headers: { + ...(requestParams.headers || {}), + ...(type && type !== ContentType.FormData + ? { "Content-Type": type } + : {}), + }, + signal: + (cancelToken + ? this.createAbortSignal(cancelToken) + : requestParams.signal) || null, + body: + typeof body === "undefined" || body === null + ? null + : payloadFormatter(body), + }, + ).then(async (response) => { + const r = response.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; + + const data = !responseFormat + ? r + : await response[responseFormat]() + .then((data) => { + if (r.ok) { + r.data = data; + } else { + r.error = data; + } + return r; + }) + .catch((e) => { + r.error = e; + return r; + }); + + if (cancelToken) { + this.abortControllers.delete(cancelToken); + } + + if (!response.ok) throw data; + return data; + }); + }; +} + +/** + * @title JSON:API Swagger Petstore + * @version 1.1 + * @baseUrl https://api.petstore.localhost + */ +export class Api< + SecurityDataType extends unknown, +> extends HttpClient { + pets = { + /** + * @description Add a new pet to the store. + * + * @tags pet + * @name AddPet + * @summary Add a new pet to the store. + * @request POST:/pets + */ + addPet: ( + data: { + data: Pet; + }, + params: RequestParams = {}, + ) => + this.request< + { + data: Pet; + }, + { + errors: Error[]; + } + >({ + path: \`/pets\`, + method: "POST", + body: data, + type: ContentType.JsonApi, + ...params, + }), + + /** + * @description Update an existing pet by Id. + * + * @tags pet + * @name UpdatePet + * @summary Update an existing pet. + * @request PATCH:/pets/{petId} + */ + updatePet: ( + petId: string, + data: { + data: Pet; + }, + params: RequestParams = {}, + ) => + this.request< + { + data: Pet; + }, + { + errors: Error[]; + } + >({ + path: \`/pets/\${petId}\`, + method: "PATCH", + body: data, + type: ContentType.JsonApi, + ...params, + }), + }; +} +" +`; diff --git a/tests/spec/jsonapi-media-type/basic.test.ts b/tests/spec/jsonapi-media-type/basic.test.ts new file mode 100644 index 00000000..f40d2a17 --- /dev/null +++ b/tests/spec/jsonapi-media-type/basic.test.ts @@ -0,0 +1,35 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("jsonapi-media-type", async () => { + await generateApi({ + fileName: "schema", + input: path.resolve(import.meta.dirname, "schema.json"), + output: tmpdir, + silent: true, + enumNamesAsValues: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/jsonapi-media-type/schema.json b/tests/spec/jsonapi-media-type/schema.json new file mode 100644 index 00000000..68039744 --- /dev/null +++ b/tests/spec/jsonapi-media-type/schema.json @@ -0,0 +1,180 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "JSON:API Swagger Petstore", + "version": "1.1" + }, + "servers": [ + { + "url": "https://api.petstore.localhost" + } + ], + "tags": [ + { + "name": "pet", + "description": "Everything about your Pets" + } + ], + "paths": { + "/pets": { + "post": { + "tags": ["pet"], + "summary": "Add a new pet to the store.", + "description": "Add a new pet to the store.", + "operationId": "addPet", + "requestBody": { + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "type": "object", + "required": ["data"], + "properties": { + "data": { + "$ref": "#/components/schemas/Pet" + } + } + } + } + } + }, + "responses": { + "200": { + "$ref": "#/components/responses/PetResponse" + }, + "default": { + "$ref": "#/components/responses/ErrorResponse" + } + } + } + }, + "/pets/{petId}": { + "patch": { + "tags": ["pet"], + "summary": "Update an existing pet.", + "description": "Update an existing pet by Id.", + "operationId": "updatePet", + "parameters": [ + { + "name": "petId", + "required": true, + "in": "path", + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "type": "object", + "required": ["data"], + "properties": { + "data": { + "$ref": "#/components/schemas/Pet" + } + } + } + } + } + }, + "responses": { + "200": { + "$ref": "#/components/responses/PetResponse" + }, + "default": { + "$ref": "#/components/responses/ErrorResponse" + } + } + } + } + }, + "components": { + "schemas": { + "Pet": { + "type": "object", + "required": ["type", "attributes"], + "properties": { + "id": { + "type": "string", + "format": "uuid" + }, + "type": { + "type": "string", + "enum": ["pet"] + }, + "attributes": { + "type": "object", + "required": ["name", "photoUrls"], + "properties": { + "name": { + "type": "string" + }, + "status": { + "type": "string", + "enum": ["available", "pending", "sold"] + }, + "photoUrls": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + }, + "Error": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "detail": { + "type": "string" + } + } + } + }, + "responses": { + "PetResponse": { + "description": "Successful operation", + "content": { + "application/vnd.api+json": { + "schema": { + "type": "object", + "required": ["data"], + "properties": { + "data": { + "$ref": "#/components/schemas/Pet" + } + } + } + } + } + }, + "ErrorResponse": { + "description": "An error occurred", + "content": { + "application/vnd.api+json": { + "schema": { + "type": "object", + "required": ["errors"], + "properties": { + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + } + } +} diff --git a/tests/spec/moduleNameFirstTag/__snapshots__/basic.test.ts.snap b/tests/spec/moduleNameFirstTag/__snapshots__/basic.test.ts.snap index ea9abdf1..f201e51e 100644 --- a/tests/spec/moduleNameFirstTag/__snapshots__/basic.test.ts.snap +++ b/tests/spec/moduleNameFirstTag/__snapshots__/basic.test.ts.snap @@ -184,6 +184,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -250,6 +251,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/moduleNameIndex/__snapshots__/basic.test.ts.snap b/tests/spec/moduleNameIndex/__snapshots__/basic.test.ts.snap index d21a2565..201f1a46 100644 --- a/tests/spec/moduleNameIndex/__snapshots__/basic.test.ts.snap +++ b/tests/spec/moduleNameIndex/__snapshots__/basic.test.ts.snap @@ -184,6 +184,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -250,6 +251,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/on-insert-path-param/__snapshots__/basic.test.ts.snap b/tests/spec/on-insert-path-param/__snapshots__/basic.test.ts.snap index 32a50eb0..74571a09 100644 --- a/tests/spec/on-insert-path-param/__snapshots__/basic.test.ts.snap +++ b/tests/spec/on-insert-path-param/__snapshots__/basic.test.ts.snap @@ -59,6 +59,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -125,6 +126,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/patch/__snapshots__/basic.test.ts.snap b/tests/spec/patch/__snapshots__/basic.test.ts.snap index ec3eeb14..1071ae26 100644 --- a/tests/spec/patch/__snapshots__/basic.test.ts.snap +++ b/tests/spec/patch/__snapshots__/basic.test.ts.snap @@ -1816,6 +1816,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -1882,6 +1883,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/responses/__snapshots__/basic.test.ts.snap b/tests/spec/responses/__snapshots__/basic.test.ts.snap index e05b1299..696057c0 100644 --- a/tests/spec/responses/__snapshots__/basic.test.ts.snap +++ b/tests/spec/responses/__snapshots__/basic.test.ts.snap @@ -99,6 +99,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -165,6 +166,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/singleHttpClient/__snapshots__/basic.test.ts.snap b/tests/spec/singleHttpClient/__snapshots__/basic.test.ts.snap index 02db71c7..378ad16b 100644 --- a/tests/spec/singleHttpClient/__snapshots__/basic.test.ts.snap +++ b/tests/spec/singleHttpClient/__snapshots__/basic.test.ts.snap @@ -59,6 +59,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -125,6 +126,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/sortTypes-false/__snapshots__/basic.test.ts.snap b/tests/spec/sortTypes-false/__snapshots__/basic.test.ts.snap index 2ff4304a..4ccf2758 100644 --- a/tests/spec/sortTypes-false/__snapshots__/basic.test.ts.snap +++ b/tests/spec/sortTypes-false/__snapshots__/basic.test.ts.snap @@ -1816,6 +1816,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -1882,6 +1883,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/sortTypes/__snapshots__/basic.test.ts.snap b/tests/spec/sortTypes/__snapshots__/basic.test.ts.snap index 99b87768..e9161f97 100644 --- a/tests/spec/sortTypes/__snapshots__/basic.test.ts.snap +++ b/tests/spec/sortTypes/__snapshots__/basic.test.ts.snap @@ -1816,6 +1816,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -1882,6 +1883,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/typeSuffixPrefix/__snapshots__/basic.test.ts.snap b/tests/spec/typeSuffixPrefix/__snapshots__/basic.test.ts.snap index c9c87110..fdb52beb 100644 --- a/tests/spec/typeSuffixPrefix/__snapshots__/basic.test.ts.snap +++ b/tests/spec/typeSuffixPrefix/__snapshots__/basic.test.ts.snap @@ -1828,6 +1828,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -1894,6 +1895,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input) diff --git a/tests/spec/unionEnums/__snapshots__/basic.test.ts.snap b/tests/spec/unionEnums/__snapshots__/basic.test.ts.snap index d3f16495..50811cc8 100644 --- a/tests/spec/unionEnums/__snapshots__/basic.test.ts.snap +++ b/tests/spec/unionEnums/__snapshots__/basic.test.ts.snap @@ -71,6 +71,7 @@ type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", + JsonApi = "application/vnd.api+json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", @@ -137,6 +138,10 @@ export class HttpClient { input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.JsonApi]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") + ? JSON.stringify(input) + : input, [ContentType.Text]: (input: any) => input !== null && typeof input !== "string" ? JSON.stringify(input)