Skip to content

feat: add Pub/Sub REST API#65

Merged
hectorvent merged 2 commits into
floci-io:mainfrom
shirkevich:codex/pubsub-rest-api
Jun 26, 2026
Merged

feat: add Pub/Sub REST API#65
hectorvent merged 2 commits into
floci-io:mainfrom
shirkevich:codex/pubsub-rest-api

Conversation

@shirkevich

Copy link
Copy Markdown
Contributor

Summary

  • Add REST JSON endpoints for Pub/Sub topics and subscriptions.
  • Add REST publish/pull support for Terraform-style provider flows.
  • Register the REST controller with the Pub/Sub service descriptor.
  • Document REST coverage and add enabled/disabled REST integration tests.

Validation

  • JAVA_HOME=/opt/homebrew/opt/openjdk@25/libexec/openjdk.jdk/Contents/Home ./mvnw test -Dtest=PubSubRestIntegrationTest,PubSubDisabledRestIntegrationTest
  • JAVA_HOME=/opt/homebrew/opt/openjdk@25/libexec/openjdk.jdk/Contents/Home ./mvnw clean package

@shirkevich shirkevich marked this pull request as ready for review June 18, 2026 10:42

@hectorvent hectorvent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this. Really nice addition, and I like that it reuses the existing PubSubService and gates cleanly through the service registry, so no extra config is needed, which is the right call.

One thing I'd want sorted before merging: the two PATCH handlers don't match GCP's REST wire format. Canonical Pub/Sub wraps the resource and carries updateMask in the body, not as a query param:

{ "topic": { "labels": {...}, "messageRetentionDuration": "604800s" },
  "updateMask": "labels,messageRetentionDuration" }

Refs: pubsub.proto UpdateTopic/UpdateTopicRequest and the REST topics.patch docs. Right now a canonical REST client would send updateMask in the body with fields nested under topic, so the controller reads them as null and ends up wiping the fields. Create, publish, pull, and ack are all fine. It's just the two updates.

Could we make the handlers accept both shapes? Read updateMask from the query param or the body, and pull fields from body.get("topic")/body.get("subscription") when present, falling back to flat. That keeps Terraform working and also covers SDK REST clients.

Small related note: the integration test drives the same flat shape the controller expects, so it can't catch this divergence. Worth a quick SDK or provider based check if easy, otherwise no big deal.

Everything else looks good to me.

@hectorvent hectorvent added the pubsub Pub/Sub label Jun 20, 2026
@hectorvent hectorvent merged commit 9529540 into floci-io:main Jun 26, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pubsub Pub/Sub

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants