googleapis / googleapis/google-cloudevents-go

Add support for Pub/Sub

Open
#154 1 comment 4 reactions 0 assignees View on GitHub
api: eventarc priority: p3 type: feature request
Dominant language
Go
Stars
31
Forks
8
PR merge metrics
No merged PRs in 30d

Description

## Current Behavior

Pub/Sub is suppressed from the code generation process in generate-code.sh because Pub/Sub messages are incompatible with protojson parsing. This is because Pub/Sub messages include duplicate fields `message_id`/`messageId`, and `publish_time`/`publishTime`, which the protobuf spec indicates is invalid.

## Expected Behavior

All Event Sources have type libraries.

## Approach

Add a custom function that can be used to pre-process Pub/Sub payloads before unmarshalling.

We already have a function in the repository that can facilitate this that was put in place to enable testing:

https://github.com/googleapis/google-cloudevents-go/blob/322c786abef2dfa47cce9a2d082ed83e47f5b10e/internal/testhelper/prepare.go#L11-L27

* Move this function to the public API, preferably into the `pubsubdata` package. This will require a copying/templating process.
* Unblock Pub/Sub from code generation
* Update the code generator to use this function instead of the internal/testheper package

https://github.com/googleapis/google-cloudevents-go/blob/322c786abef2dfa47cce9a2d082ed83e47f5b10e/generators/protoc-gen-go-googlecetypes/generator.go#L146-L147

Contributor guide

Open the contributing guide

Research direction

Start with generate-code.sh, internal/testhelper/prepare.go, and generators/protoc-gen-go-googlecetypes/generator.go around the referenced lines. Trace how generated Event Source types are produced and how the existing preparation helper is used in tests. Done means Pub/Sub is no longer suppressed, the preparation function is public in the pubsubdata package, and code generation uses it instead of internal/testhelper.

Written by the indexing model from the issue text.

Assessment

Tech stack
gcp, go
Domain
backend, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.