summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/openapi
diff options
context:
space:
mode:
authorzyoshoka <107108195+zyoshoka@users.noreply.github.com>2025-01-18 13:05:33 +0900
committerGitHub <noreply@github.com>2025-01-18 04:05:33 +0000
commit1ef62e9e335d5875a8901d13f70c3cf386bba303 (patch)
tree1015e5818b0ea0caef6d21eb53ca734971f646b9 /packages/backend/src/server/api/openapi
parentfix(backend): localOnlyなノートの時は配送処理そのものを起動... (diff)
downloadsharkey-1ef62e9e335d5875a8901d13f70c3cf386bba303.tar.gz
sharkey-1ef62e9e335d5875a8901d13f70c3cf386bba303.tar.bz2
sharkey-1ef62e9e335d5875a8901d13f70c3cf386bba303.zip
fix(backend): clone schema before converting to OAS schema to avoid mutation (#15294)
* fix(backend): clone schema before converting to OAS schema to avoid mutation * Update CHANGELOG.md * fix: use deepClone
Diffstat (limited to 'packages/backend/src/server/api/openapi')
-rw-r--r--packages/backend/src/server/api/openapi/schemas.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/backend/src/server/api/openapi/schemas.ts b/packages/backend/src/server/api/openapi/schemas.ts
index eb854a7141..c80dda8d96 100644
--- a/packages/backend/src/server/api/openapi/schemas.ts
+++ b/packages/backend/src/server/api/openapi/schemas.ts
@@ -3,13 +3,15 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
+import { deepClone } from '@/misc/clone.js';
import type { Schema } from '@/misc/json-schema.js';
import { refs } from '@/misc/json-schema.js';
export function convertSchemaToOpenApiSchema(schema: Schema, type: 'param' | 'res', includeSelfRef: boolean): any {
// optional, nullable, refはスキーマ定義に含まれないので分離しておく
// eslint-disable-next-line @typescript-eslint/no-unused-vars
- const { optional, nullable, ref, selfRef, ...res }: any = schema;
+ const { optional, nullable, ref, selfRef, ..._res }: any = schema;
+ const res = deepClone(_res);
if (schema.type === 'object' && schema.properties) {
if (type === 'res') {