Hide x-gitbook-* symbols in OpenAPI blocks (#2863)

This commit is contained in:
Nolann B.
2025-02-21 12:38:55 +01:00
committed by GitHub
parent 9f0de74caa
commit 05e1d8cd96
3 changed files with 20 additions and 3 deletions
+13 -2
View File
@@ -1,6 +1,17 @@
/**
* Stringify an OpenAPI object. Same API as JSON.stringify.
*/
export function stringifyOpenAPI(body: unknown, transformer?: null, indent?: number): string {
return JSON.stringify(body, transformer, indent);
export function stringifyOpenAPI(body: unknown, _?: null, indent?: number): string {
return JSON.stringify(
body,
(key, value) => {
// Ignore internal keys
if (key.startsWith('x-gitbook-')) {
return undefined;
}
return value;
},
indent,
);
}