From aa520bd3841755df077563ef99ab1560de4f158b Mon Sep 17 00:00:00 2001 From: Kabir Oberai Date: Sat, 24 May 2025 01:35:05 +0530 Subject: [PATCH] minor tweaks --- Sources/DeveloperAPI/patch.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/DeveloperAPI/patch.js b/Sources/DeveloperAPI/patch.js index 94155a8..8c6aed0 100644 --- a/Sources/DeveloperAPI/patch.js +++ b/Sources/DeveloperAPI/patch.js @@ -26,20 +26,20 @@ function replace(schema, value) { Object.assign(schema, value); } -function copy(schema) { +function clone(schema) { return JSON.parse(JSON.stringify(schema)); } function makeOpen(enumSchema) { replace(enumSchema, { anyOf: [ - copy(enumSchema), + clone(enumSchema), { type: 'string' }, ] }); } -function format(schema) { +function patch(schema) { const schemas = schema.components.schemas; // this field is required when using the private Xcode API @@ -83,6 +83,6 @@ function format(schema) { const text = fs.readFileSync(process.stdin.fd, 'utf8'); const json = JSON.parse(text); -const formatted = format(json); -const formattedText = JSON.stringify(formatted); -console.log(formattedText); +const patched = patch(json); +const patchedText = JSON.stringify(patched); +console.log(patchedText);