Skip to content

feat: derive stream enum validators from openapi spec#77

Merged
jscaltreto merged 3 commits into
circlefin:mainfrom
jscaltreto:feat/generate-stream-validators-from-spec
Jun 29, 2026
Merged

feat: derive stream enum validators from openapi spec#77
jscaltreto merged 3 commits into
circlefin:mainfrom
jscaltreto:feat/generate-stream-validators-from-spec

Conversation

@jscaltreto

@jscaltreto jscaltreto commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

The quicknode_stream resource rejected valid networks like arc-mainnet because its network validation list was a hand-maintained Go slice that had drifted behind the QuickNode Streams API. This PR regenerates the vendored API clients and replaces the hand-written enum validators with values generated directly from the OpenAPI spec, so they can no longer fall out of sync. It also bumps a few transitive dependencies to clear newly-disclosed CVEs flagged by the Trivy scan.

Detail

  • Regenerated vendored specs (make vendor): refreshed the QuickNode and Streams OpenAPI specs and their generated clients. The Streams spec adds a number of networks (including arc-mainnet), datasets, and destination types.
  • Added a spec-driven enum generator (api/streams/gen/generate.go): a go:generate program that reads the CreateStreamDto enums from streams-openapi.json and emits api/streams/enums.gen.go (Networks, Datasets, Destinations, Regions). Adding another enum is a one-line entry in its table.
  • Wired generation into the existing flow: a //go:generate go run gen/generate.go directive in streams.go runs alongside the client generation under make vendor / go generate ./api/.... Invoked by explicit filename because the generator carries a //go:build ignore constraint.
  • Pointed the validators at the generated slices: NetworkValidator, DatasetValidator, DestinationValidator, and RegionValidator now reference streams.*. This also corrected pre-existing drift — DestinationValidator had a stale function value and was missing azure/kafka, and DatasetValidator was missing several values.
  • Left StatusValidator hand-maintained: the create schema only permits active/paused, but a stream can be read back as terminated/completed, so it intentionally does not derive from the spec.
  • Bumped transitive dependencies to resolve Trivy findings from newly-disclosed CVEs (independent of the changes above; the affected packages are indirect deps):
    • golang.org/x/crypto v0.46.0 → v0.52.0 (x/crypto/ssh advisories)
    • golang.org/x/net v0.48.0 → v0.55.0
    • golang.org/x/sys v0.39.0 → v0.45.0

Testing

  • make vendor and make generate produce no diffs (generation is idempotent).
  • go build ./... and go vet ./... pass.
  • Verified arc-mainnet is present in the generated Networks and accepted by NetworkValidator.
  • trivy fs reports 0 vulnerabilities after the dependency bump (was 21).

Documentation

No documentation changes required.

Refresh the QuickNode and Streams API clients from the upstream specs.
The Streams spec adds several networks (including arc-mainnet), datasets,
and destination types.
Generate network, dataset, destination, and region validator values from
CreateStreamDto in the Streams OpenAPI spec instead of hand-maintaining
them. A go:generate step (wired into make vendor) writes enums.gen.go, so
the validators no longer drift from the API.

StatusValidator stays hand-maintained because streams can be read back
with status values the create schema does not accept.
Resolve Trivy findings from newly-disclosed CVEs in transitive deps:
- golang.org/x/crypto v0.46.0 -> v0.52.0 (x/crypto/ssh advisories)
- golang.org/x/net    v0.48.0 -> v0.55.0
- golang.org/x/sys    v0.39.0 -> v0.45.0

trivy fs now reports 0 vulnerabilities; go build and go vet pass.
@jscaltreto jscaltreto merged commit cb81e39 into circlefin:main Jun 29, 2026
11 checks passed
jscaltreto pushed a commit that referenced this pull request Jun 29, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.9.0](v0.8.1...v0.9.0)
(2026-06-29)


### Features

* derive stream enum validators from openapi spec
([#77](#77))
([cb81e39](cb81e39))


### Miscellaneous Chores

* **ci:** bump GitHub Actions to Node 24
([#75](#75))
([5572d5c](5572d5c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants