fix(controlplane): correct OpenAPI types for json.RawMessage and []byte fields#2736
Merged
Merged
Conversation
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.
|
Current version of PR was reviewed by /review-bugbot on Jul 19, 20:50 GMT+1. It flagged 0 findings. Bugbot on commit |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
json.RawMessagefields (datastore.Event.data,datastore.Metadata.data,ProjectEventType.json_schema) leaked Go's[]byterepresentation into the OpenAPI spec asarrayofinteger; generated SDK clients then typed event payloads aslist[int]instead of arbitrary JSON. Annotated themswaggertype:"object", matching the existing convention onapi/models/event.gorequest models.GooglePubSubConfig.ServiceAccount []byteis now documented as a base64string(format: byte), which is whatencoding/jsonactually puts on the wire.CreateDynamicEvent's@Success 201now documentsutil.ServerResponse{data=Stub}, matching the handler's actualutil.NewServerResponse(...)envelope and its sibling create-event endpoints.docs/viamake 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
datacame out aslist[int].Test plan
make generate_docsclean;openapi spec validatepassesarray-of-integerproperties;data/json_schemaareobject,service_accountis base64stringgo build/go vet/golangci-lintclean on touched packages (annotation-only change, no runtime behavior)