-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Introduce project event webhook #1113
Changes from all commits
57656b3
72982d1
4109ef3
c6c8376
d10f53f
bf2191d
b827995
0e13b36
bf2aa2a
75691ea
0acdb92
ec4dbe6
9d9899f
b53cad0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,82 +1,81 @@ | ||||||||||||||||||||||||||||||||||||
openapi: 3.1.0 | ||||||||||||||||||||||||||||||||||||
info: | ||||||||||||||||||||||||||||||||||||
description: | ||||||||||||||||||||||||||||||||||||
Yorkie is an open source document store for building collaborative | ||||||||||||||||||||||||||||||||||||
description: Yorkie is an open source document store for building collaborative | ||||||||||||||||||||||||||||||||||||
editing applications. | ||||||||||||||||||||||||||||||||||||
title: Yorkie | ||||||||||||||||||||||||||||||||||||
version: v0.5.8 | ||||||||||||||||||||||||||||||||||||
servers: | ||||||||||||||||||||||||||||||||||||
- description: Production server | ||||||||||||||||||||||||||||||||||||
url: https://api.yorkie.dev | ||||||||||||||||||||||||||||||||||||
- description: Local server | ||||||||||||||||||||||||||||||||||||
url: http://localhost:8080 | ||||||||||||||||||||||||||||||||||||
- description: Production server | ||||||||||||||||||||||||||||||||||||
url: https://api.yorkie.dev | ||||||||||||||||||||||||||||||||||||
- description: Local server | ||||||||||||||||||||||||||||||||||||
url: http://localhost:8080 | ||||||||||||||||||||||||||||||||||||
paths: | ||||||||||||||||||||||||||||||||||||
/yorkie.v1.ClusterService/DetachDocument: | ||||||||||||||||||||||||||||||||||||
post: | ||||||||||||||||||||||||||||||||||||
description: "" | ||||||||||||||||||||||||||||||||||||
requestBody: | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/requestBodies/yorkie.v1.ClusterService.DetachDocument.yorkie.v1.ClusterServiceDetachDocumentRequest" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/requestBodies/yorkie.v1.ClusterService.DetachDocument.yorkie.v1.ClusterServiceDetachDocumentRequest' | ||||||||||||||||||||||||||||||||||||
responses: | ||||||||||||||||||||||||||||||||||||
"200": | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/responses/yorkie.v1.ClusterService.DetachDocument.yorkie.v1.ClusterServiceDetachDocumentResponse" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/responses/yorkie.v1.ClusterService.DetachDocument.yorkie.v1.ClusterServiceDetachDocumentResponse' | ||||||||||||||||||||||||||||||||||||
default: | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/responses/connect.error" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/responses/connect.error' | ||||||||||||||||||||||||||||||||||||
tags: | ||||||||||||||||||||||||||||||||||||
- yorkie.v1.ClusterService | ||||||||||||||||||||||||||||||||||||
- yorkie.v1.ClusterService | ||||||||||||||||||||||||||||||||||||
components: | ||||||||||||||||||||||||||||||||||||
requestBodies: | ||||||||||||||||||||||||||||||||||||
yorkie.v1.ClusterService.DetachDocument.yorkie.v1.ClusterServiceDetachDocumentRequest: | ||||||||||||||||||||||||||||||||||||
content: | ||||||||||||||||||||||||||||||||||||
application/json: | ||||||||||||||||||||||||||||||||||||
schema: | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/schemas/yorkie.v1.ClusterServiceDetachDocumentRequest" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/schemas/yorkie.v1.ClusterServiceDetachDocumentRequest' | ||||||||||||||||||||||||||||||||||||
application/proto: | ||||||||||||||||||||||||||||||||||||
schema: | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/schemas/yorkie.v1.ClusterServiceDetachDocumentRequest" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/schemas/yorkie.v1.ClusterServiceDetachDocumentRequest' | ||||||||||||||||||||||||||||||||||||
required: true | ||||||||||||||||||||||||||||||||||||
responses: | ||||||||||||||||||||||||||||||||||||
connect.error: | ||||||||||||||||||||||||||||||||||||
content: | ||||||||||||||||||||||||||||||||||||
application/json: | ||||||||||||||||||||||||||||||||||||
schema: | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/schemas/connect.error" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/schemas/connect.error' | ||||||||||||||||||||||||||||||||||||
application/proto: | ||||||||||||||||||||||||||||||||||||
schema: | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/schemas/connect.error" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/schemas/connect.error' | ||||||||||||||||||||||||||||||||||||
description: "" | ||||||||||||||||||||||||||||||||||||
yorkie.v1.ClusterService.DetachDocument.yorkie.v1.ClusterServiceDetachDocumentResponse: | ||||||||||||||||||||||||||||||||||||
content: | ||||||||||||||||||||||||||||||||||||
application/json: | ||||||||||||||||||||||||||||||||||||
schema: | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/schemas/yorkie.v1.ClusterServiceDetachDocumentResponse" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/schemas/yorkie.v1.ClusterServiceDetachDocumentResponse' | ||||||||||||||||||||||||||||||||||||
application/proto: | ||||||||||||||||||||||||||||||||||||
schema: | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/schemas/yorkie.v1.ClusterServiceDetachDocumentResponse" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/schemas/yorkie.v1.ClusterServiceDetachDocumentResponse' | ||||||||||||||||||||||||||||||||||||
description: "" | ||||||||||||||||||||||||||||||||||||
schemas: | ||||||||||||||||||||||||||||||||||||
connect.error: | ||||||||||||||||||||||||||||||||||||
additionalProperties: false | ||||||||||||||||||||||||||||||||||||
description: "Error type returned by Connect: https://connectrpc.com/docs/go/errors/#http-representation" | ||||||||||||||||||||||||||||||||||||
description: 'Error type returned by Connect: https://connectrpc.com/docs/go/errors/#http-representation' | ||||||||||||||||||||||||||||||||||||
properties: | ||||||||||||||||||||||||||||||||||||
code: | ||||||||||||||||||||||||||||||||||||
enum: | ||||||||||||||||||||||||||||||||||||
- CodeCanceled | ||||||||||||||||||||||||||||||||||||
- CodeUnknown | ||||||||||||||||||||||||||||||||||||
- CodeInvalidArgument | ||||||||||||||||||||||||||||||||||||
- CodeDeadlineExceeded | ||||||||||||||||||||||||||||||||||||
- CodeNotFound | ||||||||||||||||||||||||||||||||||||
- CodeAlreadyExists | ||||||||||||||||||||||||||||||||||||
- CodePermissionDenied | ||||||||||||||||||||||||||||||||||||
- CodeResourceExhausted | ||||||||||||||||||||||||||||||||||||
- CodeFailedPrecondition | ||||||||||||||||||||||||||||||||||||
- CodeAborted | ||||||||||||||||||||||||||||||||||||
- CodeOutOfRange | ||||||||||||||||||||||||||||||||||||
- CodeInternal | ||||||||||||||||||||||||||||||||||||
- CodeUnavailable | ||||||||||||||||||||||||||||||||||||
- CodeDataLoss | ||||||||||||||||||||||||||||||||||||
- CodeUnauthenticated | ||||||||||||||||||||||||||||||||||||
- CodeCanceled | ||||||||||||||||||||||||||||||||||||
- CodeUnknown | ||||||||||||||||||||||||||||||||||||
- CodeInvalidArgument | ||||||||||||||||||||||||||||||||||||
- CodeDeadlineExceeded | ||||||||||||||||||||||||||||||||||||
- CodeNotFound | ||||||||||||||||||||||||||||||||||||
- CodeAlreadyExists | ||||||||||||||||||||||||||||||||||||
- CodePermissionDenied | ||||||||||||||||||||||||||||||||||||
- CodeResourceExhausted | ||||||||||||||||||||||||||||||||||||
- CodeFailedPrecondition | ||||||||||||||||||||||||||||||||||||
- CodeAborted | ||||||||||||||||||||||||||||||||||||
- CodeOutOfRange | ||||||||||||||||||||||||||||||||||||
- CodeInternal | ||||||||||||||||||||||||||||||||||||
- CodeUnavailable | ||||||||||||||||||||||||||||||||||||
- CodeDataLoss | ||||||||||||||||||||||||||||||||||||
- CodeUnauthenticated | ||||||||||||||||||||||||||||||||||||
examples: | ||||||||||||||||||||||||||||||||||||
- CodeNotFound | ||||||||||||||||||||||||||||||||||||
- CodeNotFound | ||||||||||||||||||||||||||||||||||||
type: string | ||||||||||||||||||||||||||||||||||||
message: | ||||||||||||||||||||||||||||||||||||
type: string | ||||||||||||||||||||||||||||||||||||
|
@@ -186,13 +185,13 @@ components: | |||||||||||||||||||||||||||||||||||
title: client_id | ||||||||||||||||||||||||||||||||||||
type: string | ||||||||||||||||||||||||||||||||||||
documentSummary: | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/schemas/yorkie.v1.DocumentSummary" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/schemas/yorkie.v1.DocumentSummary' | ||||||||||||||||||||||||||||||||||||
additionalProperties: false | ||||||||||||||||||||||||||||||||||||
description: "" | ||||||||||||||||||||||||||||||||||||
title: document_summary | ||||||||||||||||||||||||||||||||||||
type: object | ||||||||||||||||||||||||||||||||||||
project: | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/schemas/yorkie.v1.Project" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/schemas/yorkie.v1.Project' | ||||||||||||||||||||||||||||||||||||
additionalProperties: false | ||||||||||||||||||||||||||||||||||||
description: "" | ||||||||||||||||||||||||||||||||||||
title: project | ||||||||||||||||||||||||||||||||||||
|
@@ -209,13 +208,13 @@ components: | |||||||||||||||||||||||||||||||||||
description: "" | ||||||||||||||||||||||||||||||||||||
properties: | ||||||||||||||||||||||||||||||||||||
accessedAt: | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/schemas/google.protobuf.Timestamp" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/schemas/google.protobuf.Timestamp' | ||||||||||||||||||||||||||||||||||||
additionalProperties: false | ||||||||||||||||||||||||||||||||||||
description: "" | ||||||||||||||||||||||||||||||||||||
title: accessed_at | ||||||||||||||||||||||||||||||||||||
type: object | ||||||||||||||||||||||||||||||||||||
createdAt: | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/schemas/google.protobuf.Timestamp" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/schemas/google.protobuf.Timestamp' | ||||||||||||||||||||||||||||||||||||
additionalProperties: false | ||||||||||||||||||||||||||||||||||||
description: "" | ||||||||||||||||||||||||||||||||||||
title: created_at | ||||||||||||||||||||||||||||||||||||
|
@@ -236,7 +235,7 @@ components: | |||||||||||||||||||||||||||||||||||
title: snapshot | ||||||||||||||||||||||||||||||||||||
type: string | ||||||||||||||||||||||||||||||||||||
updatedAt: | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/schemas/google.protobuf.Timestamp" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/schemas/google.protobuf.Timestamp' | ||||||||||||||||||||||||||||||||||||
additionalProperties: false | ||||||||||||||||||||||||||||||||||||
description: "" | ||||||||||||||||||||||||||||||||||||
title: updated_at | ||||||||||||||||||||||||||||||||||||
|
@@ -265,11 +264,23 @@ components: | |||||||||||||||||||||||||||||||||||
title: client_deactivate_threshold | ||||||||||||||||||||||||||||||||||||
type: string | ||||||||||||||||||||||||||||||||||||
createdAt: | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/schemas/google.protobuf.Timestamp" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/schemas/google.protobuf.Timestamp' | ||||||||||||||||||||||||||||||||||||
additionalProperties: false | ||||||||||||||||||||||||||||||||||||
description: "" | ||||||||||||||||||||||||||||||||||||
title: created_at | ||||||||||||||||||||||||||||||||||||
type: object | ||||||||||||||||||||||||||||||||||||
eventWebhookEvents: | ||||||||||||||||||||||||||||||||||||
additionalProperties: false | ||||||||||||||||||||||||||||||||||||
description: "" | ||||||||||||||||||||||||||||||||||||
items: | ||||||||||||||||||||||||||||||||||||
type: string | ||||||||||||||||||||||||||||||||||||
title: event_webhook_events | ||||||||||||||||||||||||||||||||||||
type: array | ||||||||||||||||||||||||||||||||||||
Comment on lines
+272
to
+278
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add documentation and validation for event webhook events. The Add description and enum validation: eventWebhookEvents:
additionalProperties: false
- description: ""
+ description: "List of event types that trigger the webhook. Supported values: documentCreated, documentRemoved"
items:
+ enum:
+ - documentCreated
+ - documentRemoved
type: string
title: event_webhook_events
type: array 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||
eventWebhookUrl: | ||||||||||||||||||||||||||||||||||||
additionalProperties: false | ||||||||||||||||||||||||||||||||||||
description: "" | ||||||||||||||||||||||||||||||||||||
title: event_webhook_url | ||||||||||||||||||||||||||||||||||||
type: string | ||||||||||||||||||||||||||||||||||||
Comment on lines
+279
to
+283
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add URL format validation for webhook endpoint. The Add format validation: eventWebhookUrl:
additionalProperties: false
- description: ""
+ description: "HTTPS URL endpoint where webhook events will be delivered"
+ format: uri
+ pattern: "^https://.+"
title: event_webhook_url
type: string 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||
id: | ||||||||||||||||||||||||||||||||||||
additionalProperties: false | ||||||||||||||||||||||||||||||||||||
description: "" | ||||||||||||||||||||||||||||||||||||
|
@@ -291,7 +302,7 @@ components: | |||||||||||||||||||||||||||||||||||
title: secret_key | ||||||||||||||||||||||||||||||||||||
type: string | ||||||||||||||||||||||||||||||||||||
updatedAt: | ||||||||||||||||||||||||||||||||||||
$ref: "#/components/schemas/google.protobuf.Timestamp" | ||||||||||||||||||||||||||||||||||||
$ref: '#/components/schemas/google.protobuf.Timestamp' | ||||||||||||||||||||||||||||||||||||
additionalProperties: false | ||||||||||||||||||||||||||||||||||||
description: "" | ||||||||||||||||||||||||||||||||||||
title: updated_at | ||||||||||||||||||||||||||||||||||||
|
@@ -304,7 +315,7 @@ components: | |||||||||||||||||||||||||||||||||||
name: Authorization | ||||||||||||||||||||||||||||||||||||
type: apiKey | ||||||||||||||||||||||||||||||||||||
security: | ||||||||||||||||||||||||||||||||||||
- ApiKeyAuth: [] | ||||||||||||||||||||||||||||||||||||
- ApiKeyAuth: [] | ||||||||||||||||||||||||||||||||||||
tags: | ||||||||||||||||||||||||||||||||||||
- description: ClusterService is a service that provides an API for Cluster. | ||||||||||||||||||||||||||||||||||||
name: yorkie.v1.ClusterService | ||||||||||||||||||||||||||||||||||||
- description: ClusterService is a service that provides an API for Cluster. | ||||||||||||||||||||||||||||||||||||
name: yorkie.v1.ClusterService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add null pointer check before dereferencing.
The code directly dereferences
Value
andEvents
fields without checking ifEventWebhookUrl
orEventWebhookEvents
is nil, which could lead to a panic.📝 Committable suggestion