-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: api/*/update系の必須キーを最低限に #13824
base: develop
Are you sure you want to change the base?
refactor: api/*/update系の必須キーを最低限に #13824
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #13824 +/- ##
===========================================
+ Coverage 65.15% 66.49% +1.34%
===========================================
Files 985 988 +3
Lines 112139 116659 +4520
Branches 4457 5802 +1345
===========================================
+ Hits 73059 77573 +4514
- Misses 39049 39055 +6
Partials 31 31 ☔ View full report in Codecov by Sentry. |
このPRによるapi.jsonの差分 差分はこちら--- base
+++ head
@@ -2077,16 +2077,7 @@
}
},
"required": [
- "id",
- "memo",
- "url",
- "imageUrl",
- "place",
- "priority",
- "ratio",
- "expiresAt",
- "startsAt",
- "dayOfWeek"
+ "id"
]
}
}
@@ -14159,20 +14150,7 @@
}
},
"required": [
- "roleId",
- "name",
- "description",
- "color",
- "iconUrl",
- "target",
- "condFormula",
- "isPublic",
- "isModerator",
- "isAdministrator",
- "asBadge",
- "canEditMembersByModerator",
- "displayOrder",
- "policies"
+ "roleId"
]
}
}
@@ -27734,8 +27712,7 @@
}
},
"required": [
- "clipId",
- "name"
+ "clipId"
]
}
}
@@ -36884,9 +36861,7 @@
}
},
"required": [
- "postId",
- "title",
- "fileIds"
+ "postId"
]
}
}
@@ -49550,9 +49525,11 @@
"maxLength": 1024
},
"secret": {
- "type": "string",
- "maxLength": 1024,
- "default": ""
+ "type": [
+ "string",
+ "null"
+ ],
+ "maxLength": 1024
},
"on": {
"type": "array",
@@ -49575,11 +49552,7 @@
}
},
"required": [
- "webhookId",
- "name",
- "url",
- "on",
- "active"
+ "webhookId"
]
}
}
@@ -60671,12 +60644,7 @@
}
},
"required": [
- "pageId",
- "title",
- "name",
- "content",
- "variables",
- "script"
+ "pageId"
]
}
} |
{
...(ps.secret === null ? { secret: '' } : ps.secret ? { secret: ps.secret } : {})
} のように書かないとダメそう |
実際に以下のように変えてみましたが、同様のエラーが発生するみたいです... await this.webhooksRepository.update(webhook.id, {
name: ps.name,
url: ps.url,
on: ps.on,
active: ps.active,
...(ps.secret === null ? { secret: '' } : ps.secret ? { secret: ps.secret } : {}),
}); |
🤯 |
お恥ずかしながらid以外に適当なキーを付与したら動きました。お騒がせしてすみません。 |
できました |
f8e50f1
to
f861c0b
Compare
f861c0b
to
ed2326c
Compare
What
close #13398
上記の問題を解決します
Why
部分的な更新を行う際に元々の値を
show
などを用いて取得し、bodyに付けてから更新を行わないと予期せぬ上書きなどを起こしてしまい大変不便なため。Additional info (optional)
webhookに関してなのですが、以下のように
secret
を nullableにして nullを空文字、undefinedは更新を見送るといった挙動にしたかったのですが、undefinedになった際以下のようなエラーが出てしまってよく分からなかったため見送ってます。何かご存じでしたらご教授いただければ幸いです。Checklist