Skip to content

Commit 617f23b

Browse files
committed
Include docstring to explain purpose of replaceWithSerializableTypeIfNeeded function
1 parent 5256bcb commit 617f23b

16 files changed

Lines changed: 80 additions & 0 deletions

File tree

modules/openapi-generator/src/main/resources/typescript-axios/common.mustache

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ export const setSearchParams = function (url: URL, ...objects: any[]) {
105105
url.search = searchParams.toString();
106106
}
107107

108+
/**
109+
* JSON serialization helper function which replaces instances of unserializable types with serializable ones.
110+
* This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
111+
* Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
112+
*/
108113
export const replaceWithSerializableTypeIfNeeded = function(key: any, value: any) {
109114
if (value instanceof Set) {
110115
return Array.from(value);

samples/client/echo_api/typescript-axios/build/common.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ export const setSearchParams = function (url: URL, ...objects: any[]) {
9191
url.search = searchParams.toString();
9292
}
9393

94+
/**
95+
* JSON serialization helper function which replaces instances of unserializable types with serializable ones.
96+
* This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
97+
* Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
98+
*/
9499
export const replaceWithSerializableTypeIfNeeded = function(key: any, value: any) {
95100
if (value instanceof Set) {
96101
return Array.from(value);

samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/common.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ export const setSearchParams = function (url: URL, ...objects: any[]) {
9191
url.search = searchParams.toString();
9292
}
9393

94+
/**
95+
* JSON serialization helper function which replaces instances of unserializable types with serializable ones.
96+
* This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
97+
* Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
98+
*/
9499
export const replaceWithSerializableTypeIfNeeded = function(key: any, value: any) {
95100
if (value instanceof Set) {
96101
return Array.from(value);

samples/client/petstore/typescript-axios/builds/composed-schemas/common.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ export const setSearchParams = function (url: URL, ...objects: any[]) {
9191
url.search = searchParams.toString();
9292
}
9393

94+
/**
95+
* JSON serialization helper function which replaces instances of unserializable types with serializable ones.
96+
* This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
97+
* Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
98+
*/
9499
export const replaceWithSerializableTypeIfNeeded = function(key: any, value: any) {
95100
if (value instanceof Set) {
96101
return Array.from(value);

samples/client/petstore/typescript-axios/builds/default/common.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ export const setSearchParams = function (url: URL, ...objects: any[]) {
9191
url.search = searchParams.toString();
9292
}
9393

94+
/**
95+
* JSON serialization helper function which replaces instances of unserializable types with serializable ones.
96+
* This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
97+
* Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
98+
*/
9499
export const replaceWithSerializableTypeIfNeeded = function(key: any, value: any) {
95100
if (value instanceof Set) {
96101
return Array.from(value);

samples/client/petstore/typescript-axios/builds/es6-target/common.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ export const setSearchParams = function (url: URL, ...objects: any[]) {
9191
url.search = searchParams.toString();
9292
}
9393

94+
/**
95+
* JSON serialization helper function which replaces instances of unserializable types with serializable ones.
96+
* This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
97+
* Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
98+
*/
9499
export const replaceWithSerializableTypeIfNeeded = function(key: any, value: any) {
95100
if (value instanceof Set) {
96101
return Array.from(value);

samples/client/petstore/typescript-axios/builds/test-petstore/common.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ export const setSearchParams = function (url: URL, ...objects: any[]) {
9191
url.search = searchParams.toString();
9292
}
9393

94+
/**
95+
* JSON serialization helper function which replaces instances of unserializable types with serializable ones.
96+
* This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
97+
* Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
98+
*/
9499
export const replaceWithSerializableTypeIfNeeded = function(key: any, value: any) {
95100
if (value instanceof Set) {
96101
return Array.from(value);

samples/client/petstore/typescript-axios/builds/with-complex-headers/common.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ export const setSearchParams = function (url: URL, ...objects: any[]) {
9191
url.search = searchParams.toString();
9292
}
9393

94+
/**
95+
* JSON serialization helper function which replaces instances of unserializable types with serializable ones.
96+
* This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
97+
* Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
98+
*/
9499
export const replaceWithSerializableTypeIfNeeded = function(key: any, value: any) {
95100
if (value instanceof Set) {
96101
return Array.from(value);

samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/common.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ export const setSearchParams = function (url: URL, ...objects: any[]) {
9191
url.search = searchParams.toString();
9292
}
9393

94+
/**
95+
* JSON serialization helper function which replaces instances of unserializable types with serializable ones.
96+
* This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
97+
* Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
98+
*/
9499
export const replaceWithSerializableTypeIfNeeded = function(key: any, value: any) {
95100
if (value instanceof Set) {
96101
return Array.from(value);

samples/client/petstore/typescript-axios/builds/with-interfaces-and-with-single-request-param/common.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ export const setSearchParams = function (url: URL, ...objects: any[]) {
9191
url.search = searchParams.toString();
9292
}
9393

94+
/**
95+
* JSON serialization helper function which replaces instances of unserializable types with serializable ones.
96+
* This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
97+
* Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
98+
*/
9499
export const replaceWithSerializableTypeIfNeeded = function(key: any, value: any) {
95100
if (value instanceof Set) {
96101
return Array.from(value);

0 commit comments

Comments
 (0)