Skip to content

Commit abb4910

Browse files
authored
fix: mark arbitrary-JSON object fields as open maps in OpenAPI spec (#2737)
a bare {type: object} with no properties/additionalProperties is a closed empty object; strict SDK generators (zod in the typescript client) generate schemas that strip every key from such payloads, so event data round-tripped through the SDK serialized as {}. add a doc-gen pass that sets additionalProperties: true on json.RawMessage-backed fields (event data, metadata data, json_schema) and regenerate docs/.
1 parent bb9d6e2 commit abb4910

6 files changed

Lines changed: 73 additions & 9 deletions

File tree

docs/docs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Package docs Code generated by swaggo/swag at 2026-07-19 20:48:47.001279 +0100 WAT m=+2.325550126. DO NOT EDIT
1+
// Package docs Code generated by swaggo/swag at 2026-07-19 21:29:12.508815 +0100 WAT m=+2.208373293. DO NOT EDIT
22
package docs
33

44
import "github.com/swaggo/swag"

docs/fix_openapi_spec.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,22 @@ fix_file_inplace() {
6060
)
6161
else . end
6262
)
63+
) |
64+
65+
# Fix 3: Open up arbitrary-JSON object properties. A bare
66+
# {type: object} with no properties/additionalProperties is a CLOSED
67+
# empty object; strict SDK generators (e.g. zod) strip every key of
68+
# such payloads. json.RawMessage-backed fields must be open maps.
69+
.definitions |= with_entries(
70+
if .value.properties then
71+
.value.properties |= map_values(
72+
if type == "object" and .type == "object"
73+
and (has("properties") | not)
74+
and (has("additionalProperties") | not) then
75+
.additionalProperties = true
76+
else . end
77+
)
78+
else . end
6379
)
6480
' "$file" > "$tmpfile"
6581

@@ -89,6 +105,22 @@ fix_file_inplace() {
89105
)
90106
else . end
91107
)
108+
) |
109+
110+
# Fix 3: Open up arbitrary-JSON object properties. A bare
111+
# {type: object} with no properties/additionalProperties is a CLOSED
112+
# empty object; strict SDK generators (e.g. zod) strip every key of
113+
# such payloads. json.RawMessage-backed fields must be open maps.
114+
.definitions |= with_entries(
115+
if .value.properties then
116+
.value.properties |= map_values(
117+
if type == "object" and .type == "object"
118+
and (has("properties") | not)
119+
and (has("additionalProperties") | not) then
120+
.additionalProperties = true
121+
else . end
122+
)
123+
else . end
92124
)
93125
' | yq eval -P - > "$tmpfile"
94126
fi

docs/swagger.json

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8979,7 +8979,8 @@
89798979
},
89808980
"data": {
89818981
"description": "Data is an arbitrary JSON value that gets sent as the body of the\nwebhook to the endpoints",
8982-
"type": "object"
8982+
"type": "object",
8983+
"additionalProperties": true
89838984
},
89848985
"deleted_at": {
89858986
"type": "string"
@@ -9249,7 +9250,8 @@
92499250
"properties": {
92509251
"data": {
92519252
"description": "Data to be sent to endpoint.",
9252-
"type": "object"
9253+
"type": "object",
9254+
"additionalProperties": true
92539255
},
92549256
"interval_seconds": {
92559257
"type": "integer"
@@ -10112,7 +10114,8 @@
1011210114
},
1011310115
"data": {
1011410116
"description": "Data is an arbitrary JSON value that gets sent as the body of the\nwebhook to the endpoints",
10115-
"type": "object"
10117+
"type": "object",
10118+
"additionalProperties": true
1011610119
},
1011710120
"event_type": {
1011810121
"description": "Event Type is used for filtering and debugging e.g invoice.paid",
@@ -10300,7 +10303,8 @@
1030010303
},
1030110304
"data": {
1030210305
"description": "Data is an arbitrary JSON value that gets sent as the body of the\nwebhook to the endpoints",
10303-
"type": "object"
10306+
"type": "object",
10307+
"additionalProperties": true
1030410308
},
1030510309
"endpoint_id": {
1030610310
"description": "Specifies the endpoint to send this event to.",
@@ -10583,7 +10587,8 @@
1058310587
},
1058410588
"data": {
1058510589
"description": "Data is an arbitrary JSON value that gets sent as the body of the\nwebhook to the endpoints",
10586-
"type": "object"
10590+
"type": "object",
10591+
"additionalProperties": true
1058710592
},
1058810593
"event_type": {
1058910594
"description": "Event Type is used for filtering and debugging e.g invoice.paid",
@@ -10823,7 +10828,8 @@
1082310828
},
1082410829
"data": {
1082510830
"description": "Data is an arbitrary JSON value that gets sent as the body of the\nwebhook to the endpoints",
10826-
"type": "object"
10831+
"type": "object",
10832+
"additionalProperties": true
1082710833
},
1082810834
"deleted_at": {
1082910835
"type": "string"
@@ -10897,7 +10903,8 @@
1089710903
"type": "string"
1089810904
},
1089910905
"json_schema": {
10900-
"type": "object"
10906+
"type": "object",
10907+
"additionalProperties": true
1090110908
},
1090210909
"name": {
1090310910
"type": "string"
@@ -10949,7 +10956,8 @@
1094910956
},
1095010957
"data": {
1095110958
"description": "Data is an arbitrary JSON value that gets sent as the body of the\nwebhook to the endpoints",
10952-
"type": "object"
10959+
"type": "object",
10960+
"additionalProperties": true
1095310961
},
1095410962
"event_type": {
1095510963
"description": "Event Type is used for filtering and debugging e.g invoice.paid",

docs/swagger.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ definitions:
367367
Data is an arbitrary JSON value that gets sent as the body of the
368368
webhook to the endpoints
369369
type: object
370+
additionalProperties: true
370371
deleted_at:
371372
type: string
372373
endpoint_metadata:
@@ -552,6 +553,7 @@ definitions:
552553
data:
553554
description: Data to be sent to endpoint.
554555
type: object
556+
additionalProperties: true
555557
interval_seconds:
556558
type: integer
557559
max_retry_seconds:
@@ -1143,6 +1145,7 @@ definitions:
11431145
Data is an arbitrary JSON value that gets sent as the body of the
11441146
webhook to the endpoints
11451147
type: object
1148+
additionalProperties: true
11461149
event_type:
11471150
description: Event Type is used for filtering and debugging e.g invoice.paid
11481151
type: string
@@ -1290,6 +1293,7 @@ definitions:
12901293
Data is an arbitrary JSON value that gets sent as the body of the
12911294
webhook to the endpoints
12921295
type: object
1296+
additionalProperties: true
12931297
endpoint_id:
12941298
description: Specifies the endpoint to send this event to.
12951299
type: string
@@ -1480,6 +1484,7 @@ definitions:
14801484
Data is an arbitrary JSON value that gets sent as the body of the
14811485
webhook to the endpoints
14821486
type: object
1487+
additionalProperties: true
14831488
event_type:
14841489
description: Event Type is used for filtering and debugging e.g invoice.paid
14851490
type: string
@@ -1654,6 +1659,7 @@ definitions:
16541659
Data is an arbitrary JSON value that gets sent as the body of the
16551660
webhook to the endpoints
16561661
type: object
1662+
additionalProperties: true
16571663
deleted_at:
16581664
type: string
16591665
endpoint_metadata:
@@ -1703,6 +1709,7 @@ definitions:
17031709
type: string
17041710
json_schema:
17051711
type: object
1712+
additionalProperties: true
17061713
name:
17071714
type: string
17081715
uid:
@@ -1743,6 +1750,7 @@ definitions:
17431750
Data is an arbitrary JSON value that gets sent as the body of the
17441751
webhook to the endpoints
17451752
type: object
1753+
additionalProperties: true
17461754
event_type:
17471755
description: Event Type is used for filtering and debugging e.g invoice.paid
17481756
type: string

docs/v3/openapi3.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10142,6 +10142,7 @@
1014210142
"type": "string"
1014310143
},
1014410144
"data": {
10145+
"additionalProperties": true,
1014510146
"description": "Data is an arbitrary JSON value that gets sent as the body of the\nwebhook to the endpoints",
1014610147
"type": "object"
1014710148
},
@@ -10412,6 +10413,7 @@
1041210413
"datastore.Metadata": {
1041310414
"properties": {
1041410415
"data": {
10416+
"additionalProperties": true,
1041510417
"description": "Data to be sent to endpoint.",
1041610418
"type": "object"
1041710419
},
@@ -11275,6 +11277,7 @@
1127511277
"type": "object"
1127611278
},
1127711279
"data": {
11280+
"additionalProperties": true,
1127811281
"description": "Data is an arbitrary JSON value that gets sent as the body of the\nwebhook to the endpoints",
1127911282
"type": "object"
1128011283
},
@@ -11463,6 +11466,7 @@
1146311466
"type": "object"
1146411467
},
1146511468
"data": {
11469+
"additionalProperties": true,
1146611470
"description": "Data is an arbitrary JSON value that gets sent as the body of the\nwebhook to the endpoints",
1146711471
"type": "object"
1146811472
},
@@ -11746,6 +11750,7 @@
1174611750
"type": "object"
1174711751
},
1174811752
"data": {
11753+
"additionalProperties": true,
1174911754
"description": "Data is an arbitrary JSON value that gets sent as the body of the\nwebhook to the endpoints",
1175011755
"type": "object"
1175111756
},
@@ -11986,6 +11991,7 @@
1198611991
"type": "string"
1198711992
},
1198811993
"data": {
11994+
"additionalProperties": true,
1198911995
"description": "Data is an arbitrary JSON value that gets sent as the body of the\nwebhook to the endpoints",
1199011996
"type": "object"
1199111997
},
@@ -12061,6 +12067,7 @@
1206112067
"type": "string"
1206212068
},
1206312069
"json_schema": {
12070+
"additionalProperties": true,
1206412071
"type": "object"
1206512072
},
1206612073
"name": {
@@ -12112,6 +12119,7 @@
1211212119
"type": "object"
1211312120
},
1211412121
"data": {
12122+
"additionalProperties": true,
1211512123
"description": "Data is an arbitrary JSON value that gets sent as the body of the\nwebhook to the endpoints",
1211612124
"type": "object"
1211712125
},

docs/v3/openapi3.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5663,6 +5663,7 @@ components:
56635663
created_at:
56645664
type: string
56655665
data:
5666+
additionalProperties: true
56665667
description: |-
56675668
Data is an arbitrary JSON value that gets sent as the body of the
56685669
webhook to the endpoints
@@ -5850,6 +5851,7 @@ components:
58505851
datastore.Metadata:
58515852
properties:
58525853
data:
5854+
additionalProperties: true
58535855
description: Data to be sent to endpoint.
58545856
type: object
58555857
interval_seconds:
@@ -6444,6 +6446,7 @@ components:
64446446
Specifies custom headers you want convoy to add when the event is dispatched to your endpoint
64456447
type: object
64466448
data:
6449+
additionalProperties: true
64476450
description: |-
64486451
Data is an arbitrary JSON value that gets sent as the body of the
64496452
webhook to the endpoints
@@ -6603,6 +6606,7 @@ components:
66036606
Specifies custom headers you want convoy to add when the event is dispatched to your endpoint
66046607
type: object
66056608
data:
6609+
additionalProperties: true
66066610
description: |-
66076611
Data is an arbitrary JSON value that gets sent as the body of the
66086612
webhook to the endpoints
@@ -6797,6 +6801,7 @@ components:
67976801
Specifies custom headers you want convoy to add when the event is dispatched to your endpoint
67986802
type: object
67996803
data:
6804+
additionalProperties: true
68006805
description: |-
68016806
Data is an arbitrary JSON value that gets sent as the body of the
68026807
webhook to the endpoints
@@ -6979,6 +6984,7 @@ components:
69796984
created_at:
69806985
type: string
69816986
data:
6987+
additionalProperties: true
69826988
description: |-
69836989
Data is an arbitrary JSON value that gets sent as the body of the
69846990
webhook to the endpoints
@@ -7031,6 +7037,7 @@ components:
70317037
description:
70327038
type: string
70337039
json_schema:
7040+
additionalProperties: true
70347041
type: object
70357042
name:
70367043
type: string
@@ -7071,6 +7078,7 @@ components:
70717078
Specifies custom headers you want convoy to add when the event is dispatched to your endpoint
70727079
type: object
70737080
data:
7081+
additionalProperties: true
70747082
description: |-
70757083
Data is an arbitrary JSON value that gets sent as the body of the
70767084
webhook to the endpoints

0 commit comments

Comments
 (0)