From ae9951fa4d5cbec39805f8ac57634fb6a63c8a61 Mon Sep 17 00:00:00 2001 From: Jeremy Whitlock Date: Thu, 27 Jul 2023 10:09:49 -0400 Subject: [PATCH] feat: adapt googlepubsub bindings to v3 Changes from v2 to v3: * The `topic` property for the Channel Binding Object is no more and is now provided via the native `address` property of the Channel Object * Protobuf support now uses the native support by providing the Protobuf definition as an inline string of the `schema` property within the `payload` property of the Message Object and the `schemaFormat` property within the `payload` property of the Message Object now has valid values for Protobuf 2 and 3 * The `type` property for the Message Binding Object is no more as AsyncAPI now natively support Protobuf and this value would duplicate the `schemaFormat` in the `payload` property of the Message Object --- googlepubsub/README.md | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/googlepubsub/README.md b/googlepubsub/README.md index 6b691d09..eb72cc29 100644 --- a/googlepubsub/README.md +++ b/googlepubsub/README.md @@ -22,7 +22,6 @@ Field Name | Type | Description `messageRetentionDuration`|String|Indicates the minimum duration to retain a message after it is published to the topic _(Must be a valid [Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration).)_ `messageStoragePolicy`|[Message Storage Policy Object](#message-storage-policy-object)|Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored `schemaSettings`|[Schema Settings Object](#schema-settings-object)|Settings for validating messages published against a schema -`topic`|String|The Google Cloud Pub/Sub Topic name @@ -59,17 +58,17 @@ Field Name | Type | Description # ... channels: topic-avro-schema: + address: projects/your-project/topics/topic-avro-schema bindings: googlepubsub: - topic: projects/your-project/topics/topic-avro-schema schemaSettings: encoding: json name: projects/your-project/schemas/message-avro # ... topic-proto-schema: + address: projects/your-project/topics/topic-proto-schema bindings: googlepubsub: - topic: projects/your-project/topics/topic-proto-schema messageRetentionDuration: 86400s messageStoragePolicy: allowedPersistenceRegions: @@ -120,7 +119,6 @@ payloads using a supported Google Cloud Pub/Sub schema format like Protobuf. Field Name | Type | Description ---|---|--- `name`|String|The name of the schema -`type`|String|The type of the schema @@ -135,25 +133,31 @@ components: googlepubsub: schema: name: projects/your-project/schemas/message-avro - type: avro contentType: application/json name: MessageAvro payload: - fields: - - name: message - type: string - name: Message - type: record - schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 + schema: + fields: + - name: message + type: string + name: Message + type: record + schemaFormat: application/vnd.apache.avro+yaml;version=1.9.0 messageProto: bindings: googlepubsub: schema: name: projects/your-project/schemas/message-proto - type: protobuf contentType: application/octet-stream name: MessageProto - payload: true + payload: + schema: | + syntax = "proto3"; + + message Message { + required string message = 1; + } + schemaFormat: application/vnd.google.protobuf;version=3 # ... ```