Skip to content

fix(controlplane): correct OpenAPI types for json.RawMessage and []byte fields#2736

Merged
mekilis merged 1 commit into
mainfrom
oksmart/fix-openapi-rawmessage-types
Jul 19, 2026
Merged

fix(controlplane): correct OpenAPI types for json.RawMessage and []byte fields#2736
mekilis merged 1 commit into
mainfrom
oksmart/fix-openapi-rawmessage-types

Conversation

@mekilis

@mekilis mekilis commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • json.RawMessage fields (datastore.Event.data, datastore.Metadata.data, ProjectEventType.json_schema) leaked Go's []byte representation into the OpenAPI spec as array of integer; generated SDK clients then typed event payloads as list[int] instead of arbitrary JSON. Annotated them swaggertype:"object", matching the existing convention on api/models/event.go request models.
  • GooglePubSubConfig.ServiceAccount []byte is now documented as a base64 string (format: byte), which is what encoding/json actually puts on the wire.
  • CreateDynamicEvent's @Success 201 now documents util.ServerResponse{data=Stub}, matching the handler's actual util.NewServerResponse(...) envelope and its sibling create-event endpoints.
  • Regenerated docs/ via make generate_docs; no integer-array-typed fields remain in the spec.

Caught by SDK generation review on the first generated Python client PR (frain-dev/convoy-python#21): event data came out as list[int].

Test plan

  • make generate_docs clean; openapi spec validate passes
  • Spec audit: zero remaining array-of-integer properties; data/json_schema are object, service_account is base64 string
  • go build / go vet / golangci-lint clean on touched packages (annotation-only change, no runtime behavior)

json.RawMessage fields (event data, metadata data, event type
json_schema) leaked Go's []byte representation into the spec as
integer arrays; generated SDK clients then typed event payloads as
list[int]. Annotate them swaggertype:"object" to match the wire
format, and GooglePubSubConfig.ServiceAccount as a base64 string
(encoding/json marshals []byte as base64).

also wrap CreateDynamicEvent's 201 in util.ServerResponse{data=Stub}
to match the handler's actual envelope and its sibling endpoints.

regenerated docs/ via make generate_docs.
@cursor

cursor Bot commented Jul 19, 2026

Copy link
Copy Markdown

Current version of PR was reviewed by /review-bugbot on Jul 19, 20:50 GMT+1. It flagged 0 findings.

Bugbot on commit dd483a7 is skipped.

@mekilis mekilis changed the title fix: correct OpenAPI types for json.RawMessage and []byte fields fix(controlplane): correct OpenAPI types for json.RawMessage and []byte fields Jul 19, 2026
@mekilis
mekilis merged commit bb9d6e2 into main Jul 19, 2026
33 of 34 checks passed
@mekilis
mekilis deleted the oksmart/fix-openapi-rawmessage-types branch July 19, 2026 20:08
mekilis added a commit that referenced this pull request Jul 19, 2026
python generation moved to openapi-python-client after the speakeasy
free-tier limit (one generated SDK per workspace; convoy.js holds the
slot). document the dispatcher contract (sdk_generation.yaml filename +
inputs), the spec fidelity rules from #2736/#2737, and the switch-back
path.
@mekilis mekilis mentioned this pull request Jul 20, 2026
2 tasks
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.

1 participant