diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml index eff651b3..47258509 100644 --- a/.github/workflows/backend-tests.yml +++ b/.github/workflows/backend-tests.yml @@ -6,7 +6,6 @@ on: pull_request: branches: - main - - "release/*.*.*" paths: - "go.mod" - "go.sum" diff --git a/.github/workflows/frontend-tests.yml b/.github/workflows/frontend-tests.yml index ae9145c8..5f27a2a1 100644 --- a/.github/workflows/frontend-tests.yml +++ b/.github/workflows/frontend-tests.yml @@ -6,7 +6,6 @@ on: pull_request: branches: - main - - "release/*.*.*" paths: - "web/**" diff --git a/.github/workflows/proto-linter.yml b/.github/workflows/proto-linter.yml index 64d6f661..317b223a 100644 --- a/.github/workflows/proto-linter.yml +++ b/.github/workflows/proto-linter.yml @@ -6,7 +6,6 @@ on: pull_request: branches: - main - - "release/*.*.*" paths: - "proto/**" @@ -29,6 +28,6 @@ jobs: - name: buf format run: | if [[ $(buf format -d) ]]; then - echo "Run 'buf format -w'" + echo "Run 'buf format -d'" exit 1 fi diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yaml index 4c4403b2..df606368 100644 --- a/proto/buf.gen.yaml +++ b/proto/buf.gen.yaml @@ -1,31 +1,27 @@ -version: v1 +version: v2 managed: enabled: true - go_package_prefix: - default: github.com/usememos/memos/proto/gen - except: - - buf.build/googleapis/googleapis + disable: + - file_option: go_package + module: buf.build/googleapis/googleapis + override: + - file_option: go_package_prefix + value: github.com/usememos/memos/proto/gen plugins: - - plugin: buf.build/protocolbuffers/go + - remote: buf.build/protocolbuffers/go out: gen - opt: - - paths=source_relative - - plugin: buf.build/grpc/go + opt: paths=source_relative + - remote: buf.build/grpc/go out: gen - opt: - - paths=source_relative - - plugin: buf.build/grpc-ecosystem/gateway + opt: paths=source_relative + - remote: buf.build/grpc-ecosystem/gateway out: gen - opt: - - paths=source_relative - - plugin: buf.build/grpc-ecosystem/openapiv2 + opt: paths=source_relative + - remote: buf.build/grpc-ecosystem/openapiv2 out: gen - opt: - - output_format=yaml,allow_merge=true - # Build the TypeScript definitions for the web. - - plugin: buf.build/community/stephenh-ts-proto + opt: output_format=yaml,allow_merge=true + - remote: buf.build/community/stephenh-ts-proto out: ../web/src/types/proto - # reference: https://github.com/deeplay-io/nice-grpc/blob/master/packages/nice-grpc-web/README.md#using-ts-proto opt: - env=browser - useOptionals=messages diff --git a/proto/buf.lock b/proto/buf.lock index d029c4dc..970c0af5 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -1,13 +1,9 @@ # Generated by buf. DO NOT EDIT. -version: v1 +version: v2 deps: - - remote: buf.build - owner: googleapis - repository: googleapis + - name: buf.build/googleapis/googleapis commit: a86849a25cc04f4dbe9b15ddddfbc488 - digest: shake256:e19143328f8cbfe13fc226aeee5e63773ca494693a72740a7560664270039a380d94a1344234b88c7691311460df9a9b1c2982190d0a2612eae80368718e1943 - - remote: buf.build - owner: grpc-ecosystem - repository: grpc-gateway + digest: b5:a77a2082c596ee6800a23d8cecd021d316eb10565d6cb94532f2d7c567fe6c9a177b5bb123b51a3acb4f1f18d4f54a6da883afcb682919a137a8a37c020509a2 + - name: buf.build/grpc-ecosystem/grpc-gateway commit: 3f42134f4c564983838425bc43c7a65f - digest: shake256:3d11d4c0fe5e05fda0131afefbce233940e27f0c31c5d4e385686aea58ccd30f72053f61af432fa83f1fc11cda57f5f18ca3da26a29064f73c5a0d076bba8d92 + digest: b5:291b947d8ac09492517557e4e72e294788cb8201afc7d0df7bda80fa10931adb60d4d669208a7696bf24f1ecb2a33a16d4c1e766e6f31809248b00343119569b diff --git a/proto/buf.yaml b/proto/buf.yaml index 17bc1e1c..b72ba50b 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -1,15 +1,21 @@ -version: v1 +version: v2 name: buf.build/yourselfhosted/memos -breaking: - use: - - FILE +deps: + - buf.build/googleapis/googleapis + - buf.build/grpc-ecosystem/grpc-gateway lint: use: - BASIC except: - ENUM_VALUE_PREFIX + - FIELD_NOT_REQUIRED - PACKAGE_DIRECTORY_MATCH + - PACKAGE_NO_IMPORT_CYCLE - PACKAGE_VERSION_SUFFIX -deps: - - buf.build/googleapis/googleapis - - buf.build/grpc-ecosystem/grpc-gateway + disallow_comment_ignores: true +breaking: + use: + - FILE + except: + - EXTENSION_NO_DELETE + - FIELD_SAME_DEFAULT diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml index b685f94f..61ea6f5e 100644 --- a/proto/gen/apidocs.swagger.yaml +++ b/proto/gen/apidocs.swagger.yaml @@ -300,12 +300,16 @@ paths: type: integer format: int32 - name: pageToken - description: "A page token, received from a previous `ListMemos` call.\r\nProvide this to retrieve the subsequent page." + description: |- + A page token, received from a previous `ListMemos` call. + Provide this to retrieve the subsequent page. in: query required: false type: string - name: filter - description: "Filter is used to filter memos returned in the list.\r\nFormat: \"creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']\"" + description: |- + Filter is used to filter memos returned in the list. + Format: "creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']" in: query required: false type: string @@ -480,7 +484,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: filter - description: "Filter is used to filter users returned in the list.\r\nFormat: \"username == 'frank'\"" + description: |- + Filter is used to filter users returned in the list. + Format: "username == 'frank'" in: query required: false type: string @@ -641,7 +647,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The resource name of the workspace setting.\r\nFormat: settings/{setting}" + description: |- + The resource name of the workspace setting. + Format: settings/{setting} in: path required: true type: string @@ -663,7 +671,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: setting.name - description: "name is the name of the setting.\r\nFormat: settings/{setting}" + description: |- + name is the name of the setting. + Format: settings/{setting} in: path required: true type: string @@ -699,7 +709,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: identityProvider.name - description: "The name of the identityProvider.\r\nFormat: identityProviders/{id}" + description: |- + The name of the identityProvider. + Format: identityProviders/{id} in: path required: true type: string @@ -737,7 +749,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: inbox.name - description: "The name of the inbox.\r\nFormat: inboxes/{id}" + description: |- + The name of the inbox. + Format: inboxes/{id} in: path required: true type: string @@ -781,7 +795,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: memo.name - description: "The name of the memo.\r\nFormat: memos/{id}\r\nid is the system generated id." + description: |- + The name of the memo. + Format: memos/{id} + id is the system generated id. in: path required: true type: string @@ -799,7 +816,9 @@ paths: $ref: '#/definitions/v1RowStatus' creator: type: string - title: "The name of the creator.\r\nFormat: users/{id}" + title: |- + The name of the creator. + Format: users/{id} createTime: type: string format: date-time @@ -846,7 +865,9 @@ paths: readOnly: true parent: type: string - title: "The name of the parent memo.\r\nFormat: memos/{id}" + title: |- + The name of the parent memo. + Format: memos/{id} readOnly: true snippet: type: string @@ -871,7 +892,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_1 - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -893,7 +916,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_1 - description: "The name of the identityProvider to delete.\r\nFormat: identityProviders/{id}" + description: |- + The name of the identityProvider to delete. + Format: identityProviders/{id} in: path required: true type: string @@ -915,7 +940,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_2 - description: "The name of the identityProvider to get.\r\nFormat: identityProviders/{id}" + description: |- + The name of the identityProvider to get. + Format: identityProviders/{id} in: path required: true type: string @@ -937,7 +964,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_2 - description: "The name of the inbox to delete.\r\nFormat: inboxes/{id}" + description: |- + The name of the inbox to delete. + Format: inboxes/{id} in: path required: true type: string @@ -959,7 +988,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_3 - description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. in: path required: true type: string @@ -981,7 +1013,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_3 - description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. in: path required: true type: string @@ -1003,7 +1038,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_4 - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1025,7 +1062,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_4 - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1047,7 +1086,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the activity.\r\nFormat: activities/{id}" + description: |- + The name of the activity. + Format: activities/{id} in: path required: true type: string @@ -1069,7 +1110,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1091,7 +1134,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1112,7 +1157,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1140,7 +1187,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1167,7 +1216,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1188,7 +1239,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1215,7 +1268,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}. Use \"memos/-\" to list all properties." + description: |- + The name of the memo. + Format: memos/{id}. Use "memos/-" to list all properties. in: path required: true type: string @@ -1238,7 +1293,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}. Use \"memos/-\" to rebuild all memos." + description: |- + The name of the memo. + Format: memos/{id}. Use "memos/-" to rebuild all memos. in: path required: true type: string @@ -1265,7 +1322,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1286,7 +1345,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1313,7 +1374,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1335,7 +1398,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1362,7 +1427,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1384,7 +1451,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1411,7 +1480,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1433,13 +1504,17 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: parent - description: "The parent, who owns the tags.\r\nFormat: memos/{id}. Use \"memos/-\" to list all tags." + description: |- + The parent, who owns the tags. + Format: memos/{id}. Use "memos/-" to list all tags. in: path required: true type: string pattern: memos/[^/]+ - name: filter - description: "Filter is used to filter memos.\r\nFormat: \"creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']\"" + description: |- + Filter is used to filter memos. + Format: "creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']" in: query required: false type: string @@ -1461,7 +1536,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: parent - description: "The parent, who owns the tags.\r\nFormat: memos/{id}. Use \"memos/-\" to delete all tags." + description: |- + The parent, who owns the tags. + Format: memos/{id}. Use "memos/-" to delete all tags. in: path required: true type: string @@ -1492,7 +1569,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: parent - description: "The parent, who owns the tags.\r\nFormat: memos/{id}. Use \"memos/-\" to rename all tags." + description: |- + The parent, who owns the tags. + Format: memos/{id}. Use "memos/-" to rename all tags. in: path required: true type: string @@ -1519,7 +1598,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: resource.name - description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. in: path required: true type: string @@ -1551,7 +1633,9 @@ paths: format: int64 memo: type: string - title: "The related memo.\r\nFormat: memos/{id}" + title: |- + The related memo. + Format: memos/{id} tags: - ResourceService /api/v1/{setting.name}: @@ -1569,7 +1653,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: setting.name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1606,7 +1692,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: user.name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1660,7 +1748,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1693,7 +1783,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. in: path required: true type: string @@ -1888,7 +1981,9 @@ definitions: properties: name: type: string - title: "The name of the identityProvider.\r\nFormat: identityProviders/{id}" + title: |- + The name of the identityProvider. + Format: identityProviders/{id} type: $ref: '#/definitions/apiv1IdentityProviderType' title: @@ -1943,7 +2038,9 @@ definitions: properties: name: type: string - title: "The name of the user.\r\nFormat: users/{id}" + title: |- + The name of the user. + Format: users/{id} locale: type: string description: The preferred locale of the user. @@ -1987,7 +2084,10 @@ definitions: weekStartDayOffset: type: integer format: int32 - description: "week_start_day_offset is the week start day offset from Sunday.\r\n0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday\r\nDefault is Sunday." + description: |- + week_start_day_offset is the week start day offset from Sunday. + 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday + Default is Sunday. disallowChangeUsername: type: boolean description: disallow_change_username disallows changing username. @@ -2027,7 +2127,9 @@ definitions: properties: name: type: string - title: "name is the name of the setting.\r\nFormat: settings/{setting}" + title: |- + name is the name of the setting. + Format: settings/{setting} generalSetting: $ref: '#/definitions/apiv1WorkspaceGeneralSetting' storageSetting: @@ -2042,7 +2144,9 @@ definitions: description: storage_type is the storage type. filepathTemplate: type: string - title: "The template of file path.\r\ne.g. assets/{timestamp}_{filename}" + title: |- + The template of file path. + e.g. assets/{timestamp}_{filename} uploadSizeLimitMb: type: string format: int64 @@ -2201,7 +2305,9 @@ definitions: properties: name: type: string - title: "The name of the activity.\r\nFormat: activities/{id}" + title: |- + The name of the activity. + Format: activities/{id} creatorId: type: integer format: int32 @@ -2344,7 +2450,9 @@ definitions: properties: name: type: string - title: "The name of the inbox.\r\nFormat: inboxes/{id}" + title: |- + The name of the inbox. + Format: inboxes/{id} sender: type: string title: 'Format: users/{id}' @@ -2464,7 +2572,10 @@ definitions: additionalProperties: type: integer format: int32 - description: "tag_amounts is the amount of tags.\r\nkey is the tag name. e.g. \"tag1\".\r\nvalue is the amount of the tag." + description: |- + tag_amounts is the amount of tags. + key is the tag name. e.g. "tag1". + value is the amount of the tag. v1ListMemosResponse: type: object properties: @@ -2475,7 +2586,9 @@ definitions: $ref: '#/definitions/v1Memo' nextPageToken: type: string - description: "A token, which can be sent as `page_token` to retrieve the next page.\r\nIf this field is omitted, there are no subsequent pages." + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. v1ListNode: type: object properties: @@ -2536,7 +2649,10 @@ definitions: properties: name: type: string - description: "The name of the memo.\r\nFormat: memos/{id}\r\nid is the system generated id." + description: |- + The name of the memo. + Format: memos/{id} + id is the system generated id. uid: type: string description: The user defined id of the memo. @@ -2544,7 +2660,9 @@ definitions: $ref: '#/definitions/v1RowStatus' creator: type: string - title: "The name of the creator.\r\nFormat: users/{id}" + title: |- + The name of the creator. + Format: users/{id} createTime: type: string format: date-time @@ -2591,7 +2709,9 @@ definitions: readOnly: true parent: type: string - title: "The name of the parent memo.\r\nFormat: memos/{id}" + title: |- + The name of the parent memo. + Format: memos/{id} readOnly: true snippet: type: string @@ -2619,7 +2739,9 @@ definitions: properties: name: type: string - title: "The name of the memo property.\r\nFormat: memos/{id}/properties/{property_id}" + title: |- + The name of the memo property. + Format: memos/{id}/properties/{property_id} property: $ref: '#/definitions/v1MemoProperty' readOnly: true @@ -2632,10 +2754,14 @@ definitions: properties: memo: type: string - title: "The name of memo.\r\nFormat: \"memos/{uid}\"" + title: |- + The name of memo. + Format: "memos/{uid}" relatedMemo: type: string - title: "The name of related memo.\r\nFormat: \"memos/{uid}\"" + title: |- + The name of related memo. + Format: "memos/{uid}" type: $ref: '#/definitions/v1MemoRelationType' v1MemoRelationType: @@ -2795,7 +2921,9 @@ definitions: format: int32 creator: type: string - title: "The name of the creator.\r\nFormat: users/{id}" + title: |- + The name of the creator. + Format: users/{id} contentId: type: string reactionType: @@ -2829,7 +2957,10 @@ definitions: properties: name: type: string - description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. uid: type: string description: The user defined id of the resource. @@ -2851,7 +2982,9 @@ definitions: format: int64 memo: type: string - title: "The related memo.\r\nFormat: memos/{id}" + title: |- + The related memo. + Format: memos/{id} v1RestoreMarkdownNodesRequest: type: object properties: @@ -2973,7 +3106,9 @@ definitions: properties: name: type: string - title: "The name of the user.\r\nFormat: users/{id}" + title: |- + The name of the user. + Format: users/{id} id: type: integer format: int32 @@ -3047,7 +3182,9 @@ definitions: properties: owner: type: string - title: "The name of instance owner.\r\nFormat: \"users/{id}\"" + title: |- + The name of instance owner. + Format: "users/{id}" version: type: string title: version is the current version of instance