MCPcopy
hub / github.com/GitbookIO/gitbook / stringifyOpenAPI

Function stringifyOpenAPI

packages/react-openapi/src/stringifyOpenAPI.ts:4–25  ·  view source on GitHub ↗
(
    value: any,
    replacer?: ((this: any, key: string, value: any) => any) | null,
    space?: string | number
)

Source from the content-addressed store, hash-verified

2 * Stringify an OpenAPI object. Same API as JSON.stringify.
3 */
4export function stringifyOpenAPI(
5 value: any,
6 replacer?: ((this: any, key: string, value: any) => any) | null,
7 space?: string | number
8): string {
9 return JSON.stringify(
10 value,
11 (key, value) => {
12 // Ignore internal keys
13 if (key.startsWith('x-gitbook-')) {
14 return undefined;
15 }
16
17 if (replacer) {
18 return replacer(key, value);
19 }
20
21 return value;
22 },
23 space
24 );
25}

Callers 6

code-samples.tsFile · 0.90
getCurlBodyFunction · 0.90
generateCodeSamplesFunction · 0.90
stringifyExampleFunction · 0.90
formatExampleFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected