Skip to content
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

json-schema配下の最新化 #12312

Merged
merged 17 commits into from
Nov 21, 2023

Conversation

samunohito
Copy link
Member

What

#12311 の対応です。
json-schema配下のスキーマ定義を、対応する各種EntityServiceが返している値に近くなるように更新しています。
この対応により、ReDocの記載内容およびapi.jsonの記載内容が現在のdevelopの内容に近くなります。
(なるべく正確になるように2回くらい確認しています。…が、ヌケモレあったらごめんなさい)

※ヌケモレを発見しやすくなるよう、各種EntityService側でreturnしてる箇所と順番を合わせるような対応もしています。

Why

長らく最新化されておらず、実際のレスポンスとReDocの記載内容に乖離があった。
これを最新化することで、ReDocならびにapi.jsonの内容をより信頼の置ける状態にしたい

Additional info (optional)

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

Copy link

codecov bot commented Nov 11, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e0de863) 78.71% compared to head (3a50c7f) 78.73%.
Report is 3 commits behind head on develop.

❗ Current head 3a50c7f differs from pull request most recent head f1dfd31. Consider uploading reports for the commit f1dfd31 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #12312      +/-   ##
===========================================
+ Coverage    78.71%   78.73%   +0.01%     
===========================================
  Files          947      177     -770     
  Lines       102411    23440   -78971     
  Branches      8273      495    -7778     
===========================================
- Hits         80613    18455   -62158     
+ Misses       21798     4985   -16813     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Nov 11, 2023

このPRによるapi.jsonの差分

差分はこちら
--- base
+++ head
@@ -59536,12 +59536,6 @@
                   "optional": false,
                   "format": "id"
                 },
-                "url": {
-                  "type": "string",
-                  "format": "url",
-                  "nullable": false,
-                  "optional": false
-                },
                 "angle": {
                   "type": "number",
                   "nullable": false,
@@ -59551,6 +59545,12 @@
                   "type": "boolean",
                   "nullable": false,
                   "optional": true
+                },
+                "url": {
+                  "type": "string",
+                  "format": "url",
+                  "nullable": false,
+                  "optional": false
                 }
               },
               "required": [
@@ -59559,18 +59559,6 @@
               ]
             }
           },
-          "isAdmin": {
-            "type": "boolean",
-            "nullable": false,
-            "optional": true,
-            "default": false
-          },
-          "isModerator": {
-            "type": "boolean",
-            "nullable": false,
-            "optional": true,
-            "default": false
-          },
           "isBot": {
             "type": "boolean",
             "nullable": false,
@@ -59581,10 +59569,59 @@
             "nullable": false,
             "optional": true
           },
+          "instance": {
+            "type": "object",
+            "nullable": false,
+            "optional": true,
+            "properties": {
+              "name": {
+                "type": "string",
+                "nullable": true,
+                "optional": false
+              },
+              "softwareName": {
+                "type": "string",
+                "nullable": true,
+                "optional": false
+              },
+              "softwareVersion": {
+                "type": "string",
+                "nullable": true,
+                "optional": false
+              },
+              "iconUrl": {
+                "type": "string",
+                "nullable": true,
+                "optional": false
+              },
+              "faviconUrl": {
+                "type": "string",
+                "nullable": true,
+                "optional": false
+              },
+              "themeColor": {
+                "type": "string",
+                "nullable": true,
+                "optional": false
+              }
+            },
+            "required": [
+              "name",
+              "softwareName",
+              "softwareVersion",
+              "iconUrl",
+              "faviconUrl",
+              "themeColor"
+            ]
+          },
+          "emojis": {
+            "type": "object",
+            "nullable": false,
+            "optional": false
+          },
           "onlineStatus": {
             "type": "string",
-            "format": "url",
-            "nullable": true,
+            "nullable": false,
             "optional": false,
             "enum": [
               "unknown",
@@ -59592,6 +59629,38 @@
               "active",
               "offline"
             ]
+          },
+          "badgeRoles": {
+            "type": "array",
+            "nullable": false,
+            "optional": true,
+            "items": {
+              "type": "object",
+              "nullable": false,
+              "optional": false,
+              "properties": {
+                "name": {
+                  "type": "string",
+                  "nullable": false,
+                  "optional": false
+                },
+                "iconUrl": {
+                  "type": "string",
+                  "nullable": true,
+                  "optional": false
+                },
+                "displayOrder": {
+                  "type": "number",
+                  "nullable": false,
+                  "optional": false
+                }
+              },
+              "required": [
+                "name",
+                "iconUrl",
+                "displayOrder"
+              ]
+            }
           }
         },
         "required": [
@@ -59602,6 +59671,7 @@
           "avatarUrl",
           "avatarBlurhash",
           "avatarDecorations",
+          "emojis",
           "onlineStatus"
         ]
       },
@@ -59620,7 +59690,7 @@
             "nullable": true,
             "optional": false
           },
-          "movedToUri": {
+          "movedTo": {
             "type": "string",
             "format": "uri",
             "nullable": true,
@@ -59802,6 +59872,16 @@
             "nullable": false,
             "optional": false
           },
+          "ffVisibility": {
+            "type": "string",
+            "nullable": false,
+            "optional": false,
+            "enum": [
+              "public",
+              "followers",
+              "private"
+            ]
+          },
           "twoFactorEnabled": {
             "type": "boolean",
             "nullable": false,
@@ -59820,6 +59900,79 @@
             "optional": false,
             "default": false
           },
+          "roles": {
+            "type": "array",
+            "nullable": false,
+            "optional": false,
+            "items": {
+              "type": "object",
+              "nullable": false,
+              "optional": false,
+              "properties": {
+                "id": {
+                  "type": "string",
+                  "nullable": false,
+                  "optional": false,
+                  "format": "id"
+                },
+                "name": {
+                  "type": "string",
+                  "nullable": false,
+                  "optional": false
+                },
+                "color": {
+                  "type": "string",
+                  "nullable": true,
+                  "optional": false
+                },
+                "iconUrl": {
+                  "type": "string",
+                  "nullable": true,
+                  "optional": false
+                },
+                "description": {
+                  "type": "string",
+                  "nullable": false,
+                  "optional": false
+                },
+                "isModerator": {
+                  "type": "boolean",
+                  "nullable": false,
+                  "optional": false
+                },
+                "isAdministrator": {
+                  "type": "boolean",
+                  "nullable": false,
+                  "optional": false
+                },
+                "displayOrder": {
+                  "type": "number",
+                  "nullable": false,
+                  "optional": false
+                }
+              },
+              "required": [
+                "id",
+                "name",
+                "color",
+                "iconUrl",
+                "description",
+                "isModerator",
+                "isAdministrator",
+                "displayOrder"
+              ]
+            }
+          },
+          "memo": {
+            "type": "string",
+            "nullable": true,
+            "optional": false
+          },
+          "moderationNote": {
+            "type": "string",
+            "nullable": false,
+            "optional": true
+          },
           "isFollowing": {
             "type": "boolean",
             "nullable": false,
@@ -59860,11 +60013,6 @@
             "nullable": false,
             "optional": true
           },
-          "memo": {
-            "type": "string",
-            "nullable": false,
-            "optional": true
-          },
           "notify": {
             "type": "string",
             "nullable": false,
@@ -59879,7 +60027,7 @@
         "required": [
           "url",
           "uri",
-          "movedToUri",
+          "movedTo",
           "alsoKnownAs",
           "createdAt",
           "updatedAt",
@@ -59903,9 +60051,12 @@
           "pinnedPageId",
           "pinnedPage",
           "publicReactions",
+          "ffVisibility",
           "twoFactorEnabled",
           "usePasswordLessLogin",
-          "securityKeys"
+          "securityKeys",
+          "roles",
+          "memo"
         ]
       },
       "MeDetailedOnly": {
@@ -59923,34 +60074,44 @@
             "optional": false,
             "format": "id"
           },
-          "injectFeaturedNote": {
+          "isModerator": {
             "type": "boolean",
             "nullable": true,
             "optional": false
           },
-          "receiveAnnouncementEmail": {
+          "isAdmin": {
             "type": "boolean",
             "nullable": true,
             "optional": false
           },
+          "injectFeaturedNote": {
+            "type": "boolean",
+            "nullable": false,
+            "optional": false
+          },
+          "receiveAnnouncementEmail": {
+            "type": "boolean",
+            "nullable": false,
+            "optional": false
+          },
           "alwaysMarkNsfw": {
             "type": "boolean",
-            "nullable": true,
+            "nullable": false,
             "optional": false
           },
           "autoSensitive": {
             "type": "boolean",
-            "nullable": true,
+            "nullable": false,
             "optional": false
           },
           "carefulBot": {
             "type": "boolean",
-            "nullable": true,
+            "nullable": false,
             "optional": false
           },
           "autoAcceptFollowed": {
             "type": "boolean",
-            "nullable": true,
+            "nullable": false,
             "optional": false
           },
           "noCrawle": {
@@ -60003,11 +60164,28 @@
             "nullable": false,
             "optional": false
           },
+          "unreadAnnouncements": {
+            "type": "array",
+            "nullable": false,
+            "optional": false,
+            "items": {
+              "type": "object",
+              "nullable": false,
+              "optional": false,
+              "ref": "Announcement",
+              "$ref": "#/components/schemas/Announcement"
+            }
+          },
           "hasUnreadAntenna": {
             "type": "boolean",
             "nullable": false,
             "optional": false
           },
+          "hasUnreadChannel": {
+            "type": "boolean",
+            "nullable": false,
+            "optional": false
+          },
           "hasUnreadNotification": {
             "type": "boolean",
             "nullable": false,
@@ -60055,7 +60233,7 @@
           },
           "emailNotificationTypes": {
             "type": "array",
-            "nullable": true,
+            "nullable": false,
             "optional": false,
             "items": {
               "type": "string",
@@ -60063,6 +60241,184 @@
               "optional": false
             }
           },
+          "achievements": {
+            "type": "array",
+            "nullable": false,
+            "optional": false,
+            "items": {
+              "type": "object",
+              "nullable": false,
+              "optional": false,
+              "properties": {
+                "name": {
+                  "type": "string",
+                  "nullable": false,
+                  "optional": false
+                },
+                "unlockedAt": {
+                  "type": "number",
+                  "nullable": false,
+                  "optional": false
+                }
+              },
+              "required": [
+                "name",
+                "unlockedAt"
+              ]
+            }
+          },
+          "loggedInDays": {
+            "type": "number",
+            "nullable": false,
+            "optional": false
+          },
+          "policies": {
+            "type": "object",
+            "nullable": false,
+            "optional": false,
+            "properties": {
+              "gtlAvailable": {
+                "type": "boolean",
+                "nullable": false,
+                "optional": false
+              },
+              "ltlAvailable": {
+                "type": "boolean",
+                "nullable": false,
+                "optional": false
+              },
+              "canPublicNote": {
+                "type": "boolean",
+                "nullable": false,
+                "optional": false
+              },
+              "canInvite": {
+                "type": "boolean",
+                "nullable": false,
+                "optional": false
+              },
+              "inviteLimit": {
+                "type": "number",
+                "nullable": false,
+                "optional": false
+              },
+              "inviteLimitCycle": {
+                "type": "number",
+                "nullable": false,
+                "optional": false
+              },
+              "inviteExpirationTime": {
+                "type": "number",
+                "nullable": false,
+                "optional": false
+              },
+              "canManageCustomEmojis": {
+                "type": "boolean",
+                "nullable": false,
+                "optional": false
+              },
+              "canManageAvatarDecorations": {
+                "type": "boolean",
+                "nullable": false,
+                "optional": false
+              },
+              "canSearchNotes": {
+                "type": "boolean",
+                "nullable": false,
+                "optional": false
+              },
+              "canUseTranslator": {
+                "type": "boolean",
+                "nullable": false,
+                "optional": false
+              },
+              "canHideAds": {
+                "type": "boolean",
+                "nullable": false,
+                "optional": false
+              },
+              "driveCapacityMb": {
+                "type": "number",
+                "nullable": false,
+                "optional": false
+              },
+              "alwaysMarkNsfw": {
+                "type": "boolean",
+                "nullable": false,
+                "optional": false
+              },
+              "pinLimit": {
+                "type": "number",
+                "nullable": false,
+                "optional": false
+              },
+              "antennaLimit": {
+                "type": "number",
+                "nullable": false,
+                "optional": false
+              },
+              "wordMuteLimit": {
+                "type": "number",
+                "nullable": false,
+                "optional": false
+              },
+              "webhookLimit": {
+                "type": "number",
+                "nullable": false,
+                "optional": false
+              },
+              "clipLimit": {
+                "type": "number",
+                "nullable": false,
+                "optional": false
+              },
+              "noteEachClipsLimit": {
+                "type": "number",
+                "nullable": false,
+                "optional": false
+              },
+              "userListLimit": {
+                "type": "number",
+                "nullable": false,
+                "optional": false
+              },
+              "userEachUserListsLimit": {
+                "type": "number",
+                "nullable": false,
+                "optional": false
+              },
+              "rateLimitFactor": {
+                "type": "number",
+                "nullable": false,
+                "optional": false
+              }
+            },
+            "required": [
+              "gtlAvailable",
+              "ltlAvailable",
+              "canPublicNote",
+              "canInvite",
+              "inviteLimit",
+              "inviteLimitCycle",
+              "inviteExpirationTime",
+              "canManageCustomEmojis",
+              "canManageAvatarDecorations",
+              "canSearchNotes",
+              "canUseTranslator",
+              "canHideAds",
+              "driveCapacityMb",
+              "alwaysMarkNsfw",
+              "pinLimit",
+              "antennaLimit",
+              "wordMuteLimit",
+              "webhookLimit",
+              "clipLimit",
+              "noteEachClipsLimit",
+              "userListLimit",
+              "userEachUserListsLimit",
+              "rateLimitFactor"
+            ]
+          },
           "email": {
             "type": "string",
             "nullable": true,
@@ -60087,6 +60443,8 @@
         "required": [
           "avatarId",
           "bannerId",
+          "isModerator",
+          "isAdmin",
           "injectFeaturedNote",
           "receiveAnnouncementEmail",
           "alwaysMarkNsfw",
@@ -60102,14 +60460,19 @@
           "hasUnreadSpecifiedNotes",
           "hasUnreadMentions",
           "hasUnreadAnnouncement",
+          "unreadAnnouncements",
           "hasUnreadAntenna",
+          "hasUnreadChannel",
           "hasUnreadNotification",
           "hasPendingReceivedFollowRequest",
           "unreadNotificationsCount",
           "mutedWords",
           "mutedInstances",
           "notificationRecieveConfig",
-          "emailNotificationTypes"
+          "emailNotificationTypes",
+          "achievements",
+          "loggedInDays",
+          "policies"
         ]
       },
       "UserDetailedNotMe": {
@@ -60172,6 +60535,16 @@
             "type": "object",
             "ref": "UserDetailed",
             "$ref": "#/components/schemas/UserDetailed"
+          },
+          {
+            "type": "object",
+            "ref": "UserDetailedNotMe",
+            "$ref": "#/components/schemas/UserDetailedNotMe"
+          },
+          {
+            "type": "object",
+            "ref": "MeDetailed",
+            "$ref": "#/components/schemas/MeDetailed"
           }
         ]
       },
@@ -60267,12 +60640,17 @@
             "optional": false,
             "nullable": false
           },
-          "forYou": {
+          "needConfirmationToRead": {
             "type": "boolean",
             "optional": false,
             "nullable": false
           },
-          "needConfirmationToRead": {
+          "silence": {
+            "type": "boolean",
+            "optional": false,
+            "nullable": false
+          },
+          "forYou": {
             "type": "boolean",
             "optional": false,
             "nullable": false
@@ -60292,8 +60670,9 @@
           "imageUrl",
           "icon",
           "display",
-          "forYou",
-          "needConfirmationToRead"
+          "needConfirmationToRead",
+          "silence",
+          "forYou"
         ]
       },
       "App": {
@@ -60734,15 +61113,10 @@
             "optional": true,
             "nullable": true
           },
-          "choice": {
-            "type": "number",
-            "optional": true,
-            "nullable": true
-          },
-          "invitation": {
-            "type": "object",
+          "achievement": {
+            "type": "string",
             "optional": true,
-            "nullable": true
+            "nullable": false
           },
           "body": {
             "type": "string",
@@ -60784,17 +61158,18 @@
                 "reaction"
               ]
             }
-          }
-        },
-        "users": {
-          "type": "array",
-          "optional": true,
-          "nullable": true,
-          "items": {
-            "type": "object",
-            "ref": "UserLite",
-            "optional": false,
-            "nullable": false
+          },
+          "users": {
+            "type": "array",
+            "optional": true,
+            "nullable": true,
+            "items": {
+              "type": "object",
+              "ref": "UserLite",
+              "optional": false,
+              "nullable": false,
+              "$ref": "#/components/schemas/UserLite"
+            }
           }
         },
         "required": [
@@ -60889,7 +61264,7 @@
           "url": {
             "type": "string",
             "optional": false,
-            "nullable": true,
+            "nullable": false,
             "format": "url"
           },
           "thumbnailUrl": {
@@ -60978,6 +61353,13 @@
             "optional": false,
             "nullable": false
           },
+          "parentId": {
+            "type": "string",
+            "optional": false,
+            "nullable": true,
+            "format": "id",
+            "example": "xxxxxxxxxx"
+          },
           "foldersCount": {
             "type": "number",
             "optional": true,
@@ -60988,13 +61370,6 @@
             "optional": true,
             "nullable": false
           },
-          "parentId": {
-            "type": "string",
-            "optional": false,
-            "nullable": true,
-            "format": "id",
-            "example": "xxxxxxxxxx"
-          },
           "parent": {
             "type": "object",
             "optional": true,
@@ -61036,6 +61411,12 @@
             "nullable": false,
             "format": "id"
           },
+          "followerId": {
+            "type": "string",
+            "optional": false,
+            "nullable": false,
+            "format": "id"
+          },
           "followee": {
             "type": "object",
             "optional": true,
@@ -61047,12 +61428,6 @@
               }
             ]
           },
-          "followerId": {
-            "type": "string",
-            "optional": false,
-            "nullable": false,
-            "format": "id"
-          },
           "follower": {
             "type": "object",
             "optional": true,
@@ -61335,6 +61710,39 @@
             "nullable": false,
             "format": "date-time"
           },
+          "userId": {
+            "type": "string",
+            "optional": false,
+            "nullable": false,
+            "format": "id"
+          },
+          "user": {
+            "type": "object",
+            "ref": "UserLite",
+            "optional": false,
+            "nullable": false,
+            "$ref": "#/components/schemas/UserLite"
+          },
+          "content": {
+            "type": "array",
+            "optional": false,
+            "nullable": false,
+            "items": {
+              "type": "object",
+              "optional": false,
+              "nullable": false
+            }
+          },
+          "variables": {
+            "type": "array",
+            "optional": false,
+            "nullable": false,
+            "items": {
+              "type": "object",
+              "optional": false,
+              "nullable": false
+            }
+          },
           "title": {
             "type": "string",
             "optional": false,
@@ -61350,41 +61758,84 @@
             "optional": false,
             "nullable": true
           },
-          "content": {
-            "type": "array",
+          "hideTitleWhenPinned": {
+            "type": "boolean",
             "optional": false,
             "nullable": false
           },
-          "variables": {
-            "type": "array",
+          "alignCenter": {
+            "type": "boolean",
             "optional": false,
             "nullable": false
           },
-          "userId": {
+          "font": {
             "type": "string",
             "optional": false,
-            "nullable": false,
-            "format": "id"
+            "nullable": false
           },
-          "user": {
+          "script": {
+            "type": "string",
+            "optional": false,
+            "nullable": false
+          },
+          "eyeCatchingImageId": {
+            "type": "string",
+            "optional": false,
+            "nullable": true
+          },
+          "eyeCatchingImage": {
             "type": "object",
-            "ref": "UserLite",
+            "optional": false,
+            "nullable": true,
+            "ref": "DriveFile",
+            "allOf": [
+              {
+                "$ref": "#/components/schemas/DriveFile"
+              }
+            ]
+          },
+          "attachedFiles": {
+            "type": "array",
             "optional": false,
             "nullable": false,
-            "$ref": "#/components/schemas/UserLite"
+            "items": {
+              "type": "object",
+              "optional": false,
+              "nullable": false,
+              "ref": "DriveFile",
+              "$ref": "#/components/schemas/DriveFile"
+            }
+          },
+          "likedCount": {
+            "type": "number",
+            "optional": false,
+            "nullable": false
+          },
+          "isLiked": {
+            "type": "boolean",
+            "optional": true,
+            "nullable": false
           }
         },
         "required": [
           "id",
           "createdAt",
           "updatedAt",
+          "userId",
+          "user",
+          "content",
+          "variables",
           "title",
           "name",
           "summary",
-          "content",
-          "variables",
-          "userId",
-          "user"
+          "hideTitleWhenPinned",
+          "alignCenter",
+          "font",
+          "script",
+          "eyeCatchingImageId",
+          "eyeCatchingImage",
+          "attachedFiles",
+          "likedCount"
         ]
       },
       "Channel": {
@@ -61405,8 +61856,8 @@
           },
           "lastNotedAt": {
             "type": "string",
-            "optional": false,
             "nullable": true,
+            "optional": false,
             "format": "date-time"
           },
           "name": {
@@ -61416,8 +61867,14 @@
           },
           "description": {
             "type": "string",
+            "optional": false,
+            "nullable": true
+          },
+          "userId": {
+            "type": "string",
             "nullable": true,
-            "optional": false
+            "optional": false,
+            "format": "id"
           },
           "bannerUrl": {
             "type": "string",
@@ -61425,21 +61882,45 @@
             "nullable": true,
             "optional": false
           },
+          "pinnedNoteIds": {
+            "type": "array",
+            "nullable": false,
+            "optional": false,
+            "items": {
+              "type": "string",
+              "format": "id"
+            }
+          },
+          "color": {
+            "type": "string",
+            "optional": false,
+            "nullable": false
+          },
           "isArchived": {
             "type": "boolean",
             "optional": false,
             "nullable": false
           },
-          "notesCount": {
+          "usersCount": {
             "type": "number",
             "nullable": false,
             "optional": false
           },
-          "usersCount": {
+          "notesCount": {
             "type": "number",
             "nullable": false,
             "optional": false
           },
+          "isSensitive": {
+            "type": "boolean",
+            "optional": false,
+            "nullable": false
+          },
+          "allowRenoteToExternal": {
+            "type": "boolean",
+            "optional": false,
+            "nullable": false
+          },
           "isFollowing": {
             "type": "boolean",
             "optional": true,
@@ -61450,35 +61931,17 @@
             "optional": true,
             "nullable": false
           },
-          "userId": {
-            "type": "string",
-            "nullable": true,
-            "optional": false,
-            "format": "id"
-          },
-          "pinnedNoteIds": {
+          "pinnedNotes": {
             "type": "array",
+            "optional": true,
             "nullable": false,
-            "optional": false,
             "items": {
-              "type": "string",
-              "format": "id"
+              "type": "object",
+              "optional": false,
+              "nullable": false,
+              "ref": "Note",
+              "$ref": "#/components/schemas/Note"
             }
-          },
-          "color": {
-            "type": "string",
-            "optional": false,
-            "nullable": false
-          },
-          "isSensitive": {
-            "type": "boolean",
-            "optional": false,
-            "nullable": false
-          },
-          "allowRenoteToExternal": {
-            "type": "boolean",
-            "optional": false,
-            "nullable": false
           }
         },
         "required": [
@@ -61487,13 +61950,13 @@
           "lastNotedAt",
           "name",
           "description",
-          "bannerUrl",
-          "isArchived",
-          "notesCount",
-          "usersCount",
           "userId",
+          "bannerUrl",
           "pinnedNoteIds",
           "color",
+          "isArchived",
+          "usersCount",
+          "notesCount",
           "isSensitive",
           "allowRenoteToExternal"
         ]
@@ -61721,15 +62184,15 @@
             "optional": false,
             "nullable": false
           },
-          "isFavorited": {
-            "type": "boolean",
-            "optional": true,
-            "nullable": false
-          },
           "favoritedCount": {
             "type": "number",
             "optional": false,
             "nullable": false
+          },
+          "isFavorited": {
+            "type": "boolean",
+            "optional": true,
+            "nullable": false
           }
         },
         "required": [
@@ -61837,6 +62300,11 @@
             "optional": false,
             "nullable": true
           },
+          "isSilenced": {
+            "type": "boolean",
+            "optional": false,
+            "nullable": false
+          },
           "iconUrl": {
             "type": "string",
             "optional": false,
@@ -61854,11 +62322,6 @@
             "optional": false,
             "nullable": true
           },
-          "isSilenced": {
-            "type": "boolean",
-            "optional": false,
-            "nullable": false
-          },
           "infoUpdatedAt": {
             "type": "string",
             "optional": false,
@@ -61890,10 +62353,10 @@
           "description",
           "maintainerName",
           "maintainerEmail",
+          "isSilenced",
           "iconUrl",
           "faviconUrl",
           "themeColor",
-          "isSilenced",
           "infoUpdatedAt",
           "latestRequestReceivedAt"
         ]
@@ -61920,16 +62383,6 @@
             "nullable": false,
             "format": "date-time"
           },
-          "title": {
-            "type": "string",
-            "optional": false,
-            "nullable": false
-          },
-          "description": {
-            "type": "string",
-            "optional": false,
-            "nullable": true
-          },
           "userId": {
             "type": "string",
             "optional": false,
@@ -61943,6 +62396,16 @@
             "nullable": false,
             "$ref": "#/components/schemas/UserLite"
           },
+          "title": {
+            "type": "string",
+            "optional": false,
+            "nullable": false
+          },
+          "description": {
+            "type": "string",
+            "optional": false,
+            "nullable": true
+          },
           "fileIds": {
             "type": "array",
             "optional": true,
@@ -61980,17 +62443,28 @@
             "type": "boolean",
             "optional": false,
             "nullable": false
+          },
+          "likedCount": {
+            "type": "number",
+            "optional": false,
+            "nullable": false
+          },
+          "isLiked": {
+            "type": "boolean",
+            "optional": true,
+            "nullable": false
           }
         },
         "required": [
           "id",
           "createdAt",
           "updatedAt",
-          "title",
-          "description",
           "userId",
           "user",
-          "isSensitive"
+          "title",
+          "description",
+          "isSensitive",
+          "likedCount"
         ]
       },
       "EmojiSimple": {
@@ -62149,6 +62623,19 @@
             "nullable": false,
             "format": "date-time"
           },
+          "userId": {
+            "type": "string",
+            "optional": false,
+            "nullable": false,
+            "format": "id"
+          },
+          "user": {
+            "type": "object",
+            "ref": "UserLite",
+            "optional": false,
+            "nullable": false,
+            "$ref": "#/components/schemas/UserLite"
+          },
           "title": {
             "type": "string",
             "optional": false,
@@ -62164,19 +62651,6 @@
             "optional": false,
             "nullable": false
           },
-          "userId": {
-            "type": "string",
-            "optional": false,
-            "nullable": false,
-            "format": "id"
-          },
-          "user": {
-            "type": "object",
-            "ref": "UserLite",
-            "optional": false,
-            "nullable": false,
-            "$ref": "#/components/schemas/UserLite"
-          },
           "likedCount": {
             "type": "number",
             "optional": false,
@@ -62192,11 +62666,11 @@
           "id",
           "createdAt",
           "updatedAt",
+          "userId",
+          "user",
           "title",
           "summary",
           "script",
-          "userId",
-          "user",
           "likedCount"
         ]
       }

Get diff files from Workflow Page


return this.userEntityService.pack(userId, { id: meId }, {
detail: false,
});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hint.packedUsers.get(userId)からundefinedを引き剥がすための対応です。
!マークで対応することも可能でしたが、lintの警告が出てしまったためこのような形になりました。
不都合あれば戻しますので、お手数ですがその際はご指摘願います。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Misskeyのバックエンド見ていただければわかりますが普通に ! は使われている(lintを無視している)のでどっちでもいい気がいたします)(方針に関してはしゅいろ氏あたりに聞いてみてください)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ifで弾く書き方だと、読み手に「undefinedが入る可能性があるのか」と思わせかねないのでそのような可能性がないことが明らかな場合は ! で書くようにしてますね(とはいえ気軽には使いたくないのでlintのwarnは出すようにしてます)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここはundefinedになる可能性が十分あるので(packedUsersそのものも、packedUsersのなかにuserIdがない可能性もありえる)、今の実装でも良いのかなと思いつつ…
どうしたら良いのか分からなくなりつつあるので、方針を確認させて下さい:pray:

①このまま
②もとに戻す(ただしjson-schemaの型と合わない)
③もとに戻しつつ、hint.packedUsers.get(userId)!として型を合わせる
④json-schema側をundefined許容にする
⑤③をより安全にする(packedUsersのnullチェックだけじゃなく、hasでuserIdの有無を見る)

const user = hint?.packedUsers?.has(userId!)
	? hint.packedUsers.get(userId)!
	: this.userEntityService.pack(userId!, { id: meId }, {
		detail: false,
	});
return user;

@samunohito samunohito marked this pull request as ready for review November 11, 2023 11:25
@shiosyakeyakini-info
Copy link
Contributor

たまたま同じことに取り掛かっていた(私の方はまだ途中でした)ので見比べてみたのですが、1箇所だけ差異があってuser.tsのpackedMeDetailedOnlySchema

unreadAnnouncements: {
	type: 'array',
	nullable: false, optional: false,
	items: {
		type: 'object',
		ref: 'Announcement',
	},
},

が足りてない気がします……!

@samunohito
Copy link
Member Author

@shiosyakeyakini-info
ありがとうございます、仰るとおりでした…!助かります!

@@ -94,7 +94,7 @@ export const packedDriveFileSchema = {
},
folder: {
type: 'object',
optional: true, nullable: true,
optional: false, nullable: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optionalであることを意図しています

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直しました:pray:

7630cbe

@@ -105,7 +105,7 @@ export const packedDriveFileSchema = {
},
user: {
type: 'object',
optional: true, nullable: true,
optional: false, nullable: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optionalであることを意図しています

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直しました:pray:

7630cbe

parent: {
type: 'object',
optional: true, nullable: true,
optional: true, nullable: false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullが入るようになる可能性はある(親フォルダがない場合など)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直しました:pray:

7630cbe

@syuilo syuilo merged commit 8bd9077 into misskey-dev:develop Nov 21, 2023
16 of 18 checks passed
@syuilo
Copy link
Member

syuilo commented Nov 21, 2023

🙏🙏🙏

@syuilo
Copy link
Member

syuilo commented Nov 21, 2023

@samunohito
Copy link
Member Author

   Types of property 'channel' are incompatible.
    Type '{ id: string; name: string; color: string; isSensitive: boolean; allowRenoteToExternal: boolean; } | undefined' is not assignable to type 'SchemaType<{ readonly type: "object"; readonly optional: true; readonly nullable: true; readonly properties: { readonly id: { readonly type: "string"; readonly optional: false; readonly nullable: false; }; readonly name: { ...; }; readonly isSensitive: { ...; }; }; }>'.
      Type '{ id: string; name: string; color: string; isSensitive: boolean; allowRenoteToExternal: boolean; }' is not assignable to type 'SchemaType<{ readonly type: "object"; readonly optional: true; readonly nullable: true; readonly properties: { readonly id: { readonly type: "string"; readonly optional: false; readonly nullable: false; }; readonly name: { ...; }; readonly isSensitive: { ...; }; }; }>'.
        Object literal may only specify known properties, and 'color' does not exist in type '{ name: SchemaType<{ readonly type: "string"; readonly optional: false; readonly nullable: true; }>; id: string; } & {} & { id?: string | undefined; name?: SchemaType<{ readonly type: "string"; readonly optional: false; readonly nullable: true; }> | undefined; isSensitive?: SchemaType<...>; }'.

@samunohito
Copy link
Member Author

note.tsにあるchannelの定義が古いのか…

@samunohito
Copy link
Member Author

@syuilo
#12395
多分コレで大丈夫なはずです…

@anatawa12
Copy link
Member

8bd9077 (マージコミット) が 2023.12.0-beta.1 なのに 2023.11.1のchangelogに入ってますね。 (6b22253 のマージミス)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages/backend Server side specific issue/PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants