docusaurus-plugin-generate-schema-docs 1.5.4 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/__fixtures__/static/schemas/battle-test-event.json +771 -0
- package/__tests__/__fixtures__/static/schemas/conditional-event.json +52 -0
- package/__tests__/__fixtures__/static/schemas/nested-conditional-event.json +50 -0
- package/__tests__/__snapshots__/generateEventDocs.anchor.test.js.snap +3 -2
- package/__tests__/__snapshots__/generateEventDocs.nested.test.js.snap +4 -2
- package/__tests__/__snapshots__/generateEventDocs.test.js.snap +3 -2
- package/__tests__/components/ConditionalRows.test.js +150 -0
- package/__tests__/components/ConnectorLines.visualRegression.test.js +93 -0
- package/__tests__/components/FoldableRows.test.js +7 -4
- package/__tests__/components/SchemaRows.test.js +31 -0
- package/__tests__/components/__snapshots__/ConnectorLines.visualRegression.test.js.snap +7 -0
- package/__tests__/generateEventDocs.anchor.test.js +7 -0
- package/__tests__/generateEventDocs.nested.test.js +7 -0
- package/__tests__/generateEventDocs.partials.test.js +134 -0
- package/__tests__/generateEventDocs.test.js +7 -0
- package/__tests__/helpers/buildExampleFromSchema.test.js +49 -0
- package/__tests__/helpers/schemaToExamples.test.js +75 -0
- package/__tests__/helpers/schemaToTableData.battleTest.test.js +704 -0
- package/__tests__/helpers/schemaToTableData.hierarchicalLines.test.js +190 -7
- package/__tests__/helpers/schemaToTableData.test.js +263 -2
- package/__tests__/helpers/validator.test.js +6 -6
- package/components/ConditionalRows.js +156 -0
- package/components/FoldableRows.js +88 -61
- package/components/PropertiesTable.js +1 -1
- package/components/PropertyRow.js +24 -8
- package/components/SchemaRows.css +115 -0
- package/components/SchemaRows.js +31 -4
- package/generateEventDocs.js +55 -37
- package/helpers/buildExampleFromSchema.js +11 -0
- package/helpers/choice-index-template.js +2 -1
- package/helpers/continuingLinesStyle.js +169 -0
- package/helpers/schema-doc-template.js +2 -5
- package/helpers/schema-processing.js +3 -0
- package/helpers/schemaToExamples.js +75 -2
- package/helpers/schemaToTableData.js +252 -26
- package/helpers/update-schema-ids.js +3 -3
- package/helpers/validator.js +7 -19
- package/package.json +3 -2
|
@@ -0,0 +1,771 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://tracking-docs-demo.buchert.digital/schemas/events/battle-test-event.json",
|
|
4
|
+
"title": "Battle Test Event",
|
|
5
|
+
"description": "A stress-test event exercising every nesting combination: oneOf/anyOf inside if/then/else, if/then/else inside oneOf/anyOf branches, nested conditionals inside conditionals, array items with all combos, and deeply nested objects.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["event", "user", "items", "payment", "fulfillment"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Schema validation URL.",
|
|
12
|
+
"const": "https://tracking-docs-demo.buchert.digital/schemas/events/battle-test-event.json"
|
|
13
|
+
},
|
|
14
|
+
"event": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"const": "checkout_complete",
|
|
17
|
+
"description": "The event name.",
|
|
18
|
+
"examples": ["checkout_complete"]
|
|
19
|
+
},
|
|
20
|
+
"user": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"description": "User information with conditional fields based on account type. Demonstrates: if/then/else with oneOf inside then branch, and nested if/then/else inside then branch.",
|
|
23
|
+
"required": ["account_type"],
|
|
24
|
+
"properties": {
|
|
25
|
+
"account_type": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "Whether the user is a guest or registered.",
|
|
28
|
+
"enum": ["guest", "registered"],
|
|
29
|
+
"examples": ["registered"]
|
|
30
|
+
},
|
|
31
|
+
"user_id": {
|
|
32
|
+
"description": "The user's ID, which can be a string or integer.",
|
|
33
|
+
"oneOf": [
|
|
34
|
+
{
|
|
35
|
+
"title": "String ID",
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "A string-based user ID.",
|
|
38
|
+
"examples": ["usr-abc-123"]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"title": "Integer ID",
|
|
42
|
+
"type": "integer",
|
|
43
|
+
"description": "A numeric user ID.",
|
|
44
|
+
"examples": [98765]
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"if": {
|
|
50
|
+
"properties": { "account_type": { "const": "registered" } },
|
|
51
|
+
"required": ["account_type"]
|
|
52
|
+
},
|
|
53
|
+
"then": {
|
|
54
|
+
"description": "Registered users have a loyalty tier, preferences, and a contact method choice.",
|
|
55
|
+
"properties": {
|
|
56
|
+
"loyalty_tier": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"description": "The user's loyalty program tier.",
|
|
59
|
+
"enum": ["bronze", "silver", "gold", "platinum"],
|
|
60
|
+
"examples": ["gold"]
|
|
61
|
+
},
|
|
62
|
+
"contact_method": {
|
|
63
|
+
"description": "How to reach the registered user — oneOf inside a then branch.",
|
|
64
|
+
"oneOf": [
|
|
65
|
+
{
|
|
66
|
+
"title": "Email Contact",
|
|
67
|
+
"type": "object",
|
|
68
|
+
"description": "Contact via email.",
|
|
69
|
+
"properties": {
|
|
70
|
+
"channel": { "type": "string", "const": "email" },
|
|
71
|
+
"email_address": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"format": "email",
|
|
74
|
+
"description": "The user's email address.",
|
|
75
|
+
"examples": ["user@example.com"]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"required": ["channel", "email_address"]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"title": "SMS Contact",
|
|
82
|
+
"type": "object",
|
|
83
|
+
"description": "Contact via SMS.",
|
|
84
|
+
"properties": {
|
|
85
|
+
"channel": { "type": "string", "const": "sms" },
|
|
86
|
+
"phone_number": {
|
|
87
|
+
"type": "string",
|
|
88
|
+
"description": "The user's phone number.",
|
|
89
|
+
"pattern": "^\\+[0-9]{10,15}$",
|
|
90
|
+
"examples": ["+1234567890"]
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"required": ["channel", "phone_number"]
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"preferences": {
|
|
98
|
+
"type": "object",
|
|
99
|
+
"description": "User notification preferences with nested if/then/else (if/then/else inside if/then).",
|
|
100
|
+
"required": ["marketing_consent"],
|
|
101
|
+
"properties": {
|
|
102
|
+
"marketing_consent": {
|
|
103
|
+
"type": "boolean",
|
|
104
|
+
"description": "Whether the user consented to marketing.",
|
|
105
|
+
"examples": [true]
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"if": {
|
|
109
|
+
"properties": { "marketing_consent": { "const": true } },
|
|
110
|
+
"required": ["marketing_consent"]
|
|
111
|
+
},
|
|
112
|
+
"then": {
|
|
113
|
+
"description": "Consenting users specify their preferred frequency.",
|
|
114
|
+
"properties": {
|
|
115
|
+
"frequency": {
|
|
116
|
+
"type": "string",
|
|
117
|
+
"description": "How often to send marketing messages.",
|
|
118
|
+
"enum": ["daily", "weekly", "monthly"],
|
|
119
|
+
"examples": ["weekly"]
|
|
120
|
+
},
|
|
121
|
+
"topics": {
|
|
122
|
+
"type": "array",
|
|
123
|
+
"description": "Marketing topics of interest.",
|
|
124
|
+
"items": { "type": "string" },
|
|
125
|
+
"examples": [["deals", "new_arrivals"]]
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"required": ["frequency"]
|
|
129
|
+
},
|
|
130
|
+
"else": {
|
|
131
|
+
"description": "Non-consenting users only have an opt-out reason.",
|
|
132
|
+
"properties": {
|
|
133
|
+
"opt_out_reason": {
|
|
134
|
+
"type": "string",
|
|
135
|
+
"description": "Why the user declined marketing.",
|
|
136
|
+
"examples": ["too_many_emails"]
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"required": ["loyalty_tier"]
|
|
143
|
+
},
|
|
144
|
+
"else": {
|
|
145
|
+
"description": "Guest users only have a session ID.",
|
|
146
|
+
"properties": {
|
|
147
|
+
"session_id": {
|
|
148
|
+
"type": "string",
|
|
149
|
+
"description": "Temporary session identifier for guest users.",
|
|
150
|
+
"examples": ["sess-xyz-789"]
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"required": ["session_id"]
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"items": {
|
|
157
|
+
"type": "array",
|
|
158
|
+
"description": "Cart items with if/then/else in array items, and oneOf inside then/else branches.",
|
|
159
|
+
"minItems": 1,
|
|
160
|
+
"items": {
|
|
161
|
+
"type": "object",
|
|
162
|
+
"required": ["item_type", "name", "price"],
|
|
163
|
+
"properties": {
|
|
164
|
+
"item_type": {
|
|
165
|
+
"type": "string",
|
|
166
|
+
"description": "Whether this is a physical or digital item.",
|
|
167
|
+
"enum": ["physical", "digital"],
|
|
168
|
+
"examples": ["physical"]
|
|
169
|
+
},
|
|
170
|
+
"name": {
|
|
171
|
+
"type": "string",
|
|
172
|
+
"description": "Item name.",
|
|
173
|
+
"examples": ["Wireless Headphones"]
|
|
174
|
+
},
|
|
175
|
+
"price": {
|
|
176
|
+
"type": "number",
|
|
177
|
+
"description": "Item price in the transaction currency.",
|
|
178
|
+
"minimum": 0,
|
|
179
|
+
"examples": [79.99]
|
|
180
|
+
},
|
|
181
|
+
"quantity": {
|
|
182
|
+
"type": "integer",
|
|
183
|
+
"description": "Number of units.",
|
|
184
|
+
"minimum": 1,
|
|
185
|
+
"default": 1,
|
|
186
|
+
"examples": [2]
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"if": {
|
|
190
|
+
"properties": { "item_type": { "const": "physical" } },
|
|
191
|
+
"required": ["item_type"]
|
|
192
|
+
},
|
|
193
|
+
"then": {
|
|
194
|
+
"description": "Physical items have weight, dimensions, and a shipping class choice (oneOf inside then).",
|
|
195
|
+
"properties": {
|
|
196
|
+
"weight_kg": {
|
|
197
|
+
"type": "number",
|
|
198
|
+
"description": "Item weight in kilograms.",
|
|
199
|
+
"minimum": 0.01,
|
|
200
|
+
"examples": [0.35]
|
|
201
|
+
},
|
|
202
|
+
"dimensions": {
|
|
203
|
+
"type": "object",
|
|
204
|
+
"description": "Package dimensions in centimeters.",
|
|
205
|
+
"properties": {
|
|
206
|
+
"length": {
|
|
207
|
+
"type": "number",
|
|
208
|
+
"description": "Length in cm.",
|
|
209
|
+
"examples": [20]
|
|
210
|
+
},
|
|
211
|
+
"width": {
|
|
212
|
+
"type": "number",
|
|
213
|
+
"description": "Width in cm.",
|
|
214
|
+
"examples": [15]
|
|
215
|
+
},
|
|
216
|
+
"height": {
|
|
217
|
+
"type": "number",
|
|
218
|
+
"description": "Height in cm.",
|
|
219
|
+
"examples": [8]
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
"shipping_class": {
|
|
224
|
+
"description": "Shipping classification — oneOf inside a then branch.",
|
|
225
|
+
"oneOf": [
|
|
226
|
+
{
|
|
227
|
+
"title": "Standard Parcel",
|
|
228
|
+
"type": "object",
|
|
229
|
+
"description": "Regular parcel shipping.",
|
|
230
|
+
"properties": {
|
|
231
|
+
"class": { "type": "string", "const": "standard_parcel" },
|
|
232
|
+
"estimated_days": {
|
|
233
|
+
"type": "integer",
|
|
234
|
+
"description": "Estimated delivery days.",
|
|
235
|
+
"minimum": 1,
|
|
236
|
+
"examples": [5]
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
"required": ["class"]
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"title": "Freight",
|
|
243
|
+
"type": "object",
|
|
244
|
+
"description": "Heavy/oversized freight shipping.",
|
|
245
|
+
"properties": {
|
|
246
|
+
"class": { "type": "string", "const": "freight" },
|
|
247
|
+
"requires_signature": {
|
|
248
|
+
"type": "boolean",
|
|
249
|
+
"description": "Whether delivery requires a signature.",
|
|
250
|
+
"examples": [true]
|
|
251
|
+
},
|
|
252
|
+
"pallet_count": {
|
|
253
|
+
"type": "integer",
|
|
254
|
+
"description": "Number of pallets.",
|
|
255
|
+
"minimum": 1,
|
|
256
|
+
"examples": [1]
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
"required": ["class", "requires_signature"]
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
"else": {
|
|
266
|
+
"description": "Digital items have a download URL and license type.",
|
|
267
|
+
"properties": {
|
|
268
|
+
"download_url": {
|
|
269
|
+
"type": "string",
|
|
270
|
+
"format": "uri",
|
|
271
|
+
"description": "URL to download the digital item.",
|
|
272
|
+
"examples": ["https://example.com/download/abc"]
|
|
273
|
+
},
|
|
274
|
+
"license_type": {
|
|
275
|
+
"type": "string",
|
|
276
|
+
"description": "License model for the digital item.",
|
|
277
|
+
"enum": ["single-use", "perpetual", "subscription"],
|
|
278
|
+
"examples": ["perpetual"]
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"payment": {
|
|
285
|
+
"type": "object",
|
|
286
|
+
"description": "Payment details — anyOf with if/then/else inside one of the anyOf branches.",
|
|
287
|
+
"required": ["currency"],
|
|
288
|
+
"properties": {
|
|
289
|
+
"currency": {
|
|
290
|
+
"type": "string",
|
|
291
|
+
"description": "ISO 4217 currency code.",
|
|
292
|
+
"pattern": "^[A-Z]{3}$",
|
|
293
|
+
"examples": ["USD"]
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
"anyOf": [
|
|
297
|
+
{
|
|
298
|
+
"title": "Credit Card",
|
|
299
|
+
"description": "Payment by credit card — includes if/then/else based on card brand (if/then/else inside anyOf).",
|
|
300
|
+
"properties": {
|
|
301
|
+
"method": { "type": "string", "const": "credit_card" },
|
|
302
|
+
"card_brand": {
|
|
303
|
+
"type": "string",
|
|
304
|
+
"description": "Card network.",
|
|
305
|
+
"enum": ["visa", "mastercard", "amex"],
|
|
306
|
+
"examples": ["visa"]
|
|
307
|
+
},
|
|
308
|
+
"last_four": {
|
|
309
|
+
"type": "string",
|
|
310
|
+
"description": "Last four digits of the card.",
|
|
311
|
+
"pattern": "^[0-9]{4}$",
|
|
312
|
+
"examples": ["4242"]
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
"required": ["method", "card_brand", "last_four"],
|
|
316
|
+
"if": {
|
|
317
|
+
"properties": { "card_brand": { "const": "amex" } },
|
|
318
|
+
"required": ["card_brand"]
|
|
319
|
+
},
|
|
320
|
+
"then": {
|
|
321
|
+
"description": "Amex cards require a CID (4-digit security code).",
|
|
322
|
+
"properties": {
|
|
323
|
+
"cid": {
|
|
324
|
+
"type": "string",
|
|
325
|
+
"description": "4-digit Card Identification Number for Amex.",
|
|
326
|
+
"pattern": "^[0-9]{4}$",
|
|
327
|
+
"examples": ["1234"]
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
"required": ["cid"]
|
|
331
|
+
},
|
|
332
|
+
"else": {
|
|
333
|
+
"description": "Non-Amex cards use a 3-digit CVV.",
|
|
334
|
+
"properties": {
|
|
335
|
+
"cvv": {
|
|
336
|
+
"type": "string",
|
|
337
|
+
"description": "3-digit Card Verification Value.",
|
|
338
|
+
"pattern": "^[0-9]{3}$",
|
|
339
|
+
"examples": ["123"]
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"title": "Digital Wallet",
|
|
346
|
+
"description": "Payment by digital wallet.",
|
|
347
|
+
"properties": {
|
|
348
|
+
"method": { "type": "string", "const": "digital_wallet" },
|
|
349
|
+
"wallet_provider": {
|
|
350
|
+
"description": "The wallet provider, either a known name or a custom string.",
|
|
351
|
+
"oneOf": [
|
|
352
|
+
{
|
|
353
|
+
"title": "Known Provider",
|
|
354
|
+
"type": "string",
|
|
355
|
+
"enum": ["apple_pay", "google_pay", "paypal"],
|
|
356
|
+
"examples": ["apple_pay"]
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"title": "Custom Provider",
|
|
360
|
+
"type": "string",
|
|
361
|
+
"pattern": "^custom_",
|
|
362
|
+
"description": "A custom wallet provider prefixed with 'custom_'.",
|
|
363
|
+
"examples": ["custom_klarna"]
|
|
364
|
+
}
|
|
365
|
+
]
|
|
366
|
+
},
|
|
367
|
+
"wallet_email": {
|
|
368
|
+
"type": "string",
|
|
369
|
+
"format": "email",
|
|
370
|
+
"description": "Email linked to the wallet account.",
|
|
371
|
+
"examples": ["user@example.com"]
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
"required": ["method", "wallet_provider"]
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"title": "Bank Transfer",
|
|
378
|
+
"description": "Payment by bank transfer.",
|
|
379
|
+
"properties": {
|
|
380
|
+
"method": { "type": "string", "const": "bank_transfer" },
|
|
381
|
+
"bank_name": {
|
|
382
|
+
"type": "string",
|
|
383
|
+
"description": "Name of the bank.",
|
|
384
|
+
"examples": ["First National Bank"]
|
|
385
|
+
},
|
|
386
|
+
"reference_id": {
|
|
387
|
+
"type": "string",
|
|
388
|
+
"description": "Transfer reference number.",
|
|
389
|
+
"examples": ["TXN-2026-001"]
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
"required": ["method", "bank_name", "reference_id"]
|
|
393
|
+
}
|
|
394
|
+
]
|
|
395
|
+
},
|
|
396
|
+
"fulfillment": {
|
|
397
|
+
"type": "object",
|
|
398
|
+
"description": "Fulfillment details — anyOf with different fulfillment types, some containing nested if/then/else.",
|
|
399
|
+
"required": ["type"],
|
|
400
|
+
"properties": {
|
|
401
|
+
"type": {
|
|
402
|
+
"type": "string",
|
|
403
|
+
"description": "Fulfillment type.",
|
|
404
|
+
"enum": ["delivery", "pickup", "digital"],
|
|
405
|
+
"examples": ["delivery"]
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
"anyOf": [
|
|
409
|
+
{
|
|
410
|
+
"title": "Home Delivery",
|
|
411
|
+
"description": "Home delivery with if/then/else based on whether it's international.",
|
|
412
|
+
"properties": {
|
|
413
|
+
"fulfillment_method": {
|
|
414
|
+
"type": "string",
|
|
415
|
+
"const": "home_delivery"
|
|
416
|
+
},
|
|
417
|
+
"address": {
|
|
418
|
+
"type": "object",
|
|
419
|
+
"description": "Delivery address.",
|
|
420
|
+
"required": ["country", "city"],
|
|
421
|
+
"properties": {
|
|
422
|
+
"country": {
|
|
423
|
+
"type": "string",
|
|
424
|
+
"description": "ISO 3166-1 alpha-2 country code.",
|
|
425
|
+
"examples": ["US"]
|
|
426
|
+
},
|
|
427
|
+
"city": {
|
|
428
|
+
"type": "string",
|
|
429
|
+
"description": "City name.",
|
|
430
|
+
"examples": ["New York"]
|
|
431
|
+
},
|
|
432
|
+
"street": {
|
|
433
|
+
"type": "string",
|
|
434
|
+
"description": "Street address.",
|
|
435
|
+
"examples": ["123 Main St"]
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
"if": {
|
|
439
|
+
"properties": { "country": { "not": { "const": "US" } } },
|
|
440
|
+
"required": ["country"]
|
|
441
|
+
},
|
|
442
|
+
"then": {
|
|
443
|
+
"description": "International addresses require a customs declaration.",
|
|
444
|
+
"properties": {
|
|
445
|
+
"customs_declaration": {
|
|
446
|
+
"type": "object",
|
|
447
|
+
"description": "Customs information for international shipments.",
|
|
448
|
+
"properties": {
|
|
449
|
+
"declared_value": {
|
|
450
|
+
"type": "number",
|
|
451
|
+
"description": "Declared value for customs.",
|
|
452
|
+
"examples": [150.0]
|
|
453
|
+
},
|
|
454
|
+
"contents_description": {
|
|
455
|
+
"type": "string",
|
|
456
|
+
"description": "Description of package contents.",
|
|
457
|
+
"examples": ["Electronics"]
|
|
458
|
+
},
|
|
459
|
+
"hs_code": {
|
|
460
|
+
"type": "string",
|
|
461
|
+
"description": "Harmonized System tariff code.",
|
|
462
|
+
"examples": ["8518.30"]
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
"required": ["declared_value", "contents_description"]
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
"required": ["customs_declaration"]
|
|
469
|
+
},
|
|
470
|
+
"else": {
|
|
471
|
+
"description": "Domestic US addresses may include a ZIP+4.",
|
|
472
|
+
"properties": {
|
|
473
|
+
"zip_plus_four": {
|
|
474
|
+
"type": "string",
|
|
475
|
+
"description": "Extended ZIP code.",
|
|
476
|
+
"pattern": "^[0-9]{5}-[0-9]{4}$",
|
|
477
|
+
"examples": ["10001-1234"]
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
"required": ["fulfillment_method", "address"]
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"title": "Store Pickup",
|
|
487
|
+
"description": "In-store pickup.",
|
|
488
|
+
"properties": {
|
|
489
|
+
"fulfillment_method": { "type": "string", "const": "store_pickup" },
|
|
490
|
+
"store_id": {
|
|
491
|
+
"type": "string",
|
|
492
|
+
"description": "ID of the pickup store.",
|
|
493
|
+
"examples": ["STORE-42"]
|
|
494
|
+
},
|
|
495
|
+
"pickup_time": {
|
|
496
|
+
"description": "When to pick up — anyOf inside an anyOf branch.",
|
|
497
|
+
"anyOf": [
|
|
498
|
+
{
|
|
499
|
+
"title": "Scheduled Time",
|
|
500
|
+
"type": "object",
|
|
501
|
+
"description": "A specific scheduled pickup time.",
|
|
502
|
+
"properties": {
|
|
503
|
+
"slot_type": { "type": "string", "const": "scheduled" },
|
|
504
|
+
"datetime": {
|
|
505
|
+
"type": "string",
|
|
506
|
+
"format": "date-time",
|
|
507
|
+
"description": "Scheduled pickup date and time.",
|
|
508
|
+
"examples": ["2026-03-15T14:00:00Z"]
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
"required": ["slot_type", "datetime"]
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
"title": "ASAP Pickup",
|
|
515
|
+
"type": "object",
|
|
516
|
+
"description": "Pick up as soon as possible.",
|
|
517
|
+
"properties": {
|
|
518
|
+
"slot_type": { "type": "string", "const": "asap" },
|
|
519
|
+
"estimated_ready_minutes": {
|
|
520
|
+
"type": "integer",
|
|
521
|
+
"description": "Estimated minutes until ready.",
|
|
522
|
+
"minimum": 5,
|
|
523
|
+
"examples": [30]
|
|
524
|
+
}
|
|
525
|
+
},
|
|
526
|
+
"required": ["slot_type"]
|
|
527
|
+
}
|
|
528
|
+
]
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
"required": ["fulfillment_method", "store_id"]
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"title": "Digital Fulfillment",
|
|
535
|
+
"description": "Purely digital delivery.",
|
|
536
|
+
"properties": {
|
|
537
|
+
"fulfillment_method": { "type": "string", "const": "digital" },
|
|
538
|
+
"delivery_email": {
|
|
539
|
+
"type": "string",
|
|
540
|
+
"format": "email",
|
|
541
|
+
"description": "Email to send digital items to.",
|
|
542
|
+
"examples": ["buyer@example.com"]
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
"required": ["fulfillment_method", "delivery_email"]
|
|
546
|
+
}
|
|
547
|
+
]
|
|
548
|
+
},
|
|
549
|
+
"discount": {
|
|
550
|
+
"description": "Applied discount — either a percentage or a fixed amount.",
|
|
551
|
+
"oneOf": [
|
|
552
|
+
{
|
|
553
|
+
"title": "Percentage Discount",
|
|
554
|
+
"type": "object",
|
|
555
|
+
"description": "A percentage-based discount.",
|
|
556
|
+
"properties": {
|
|
557
|
+
"type": { "type": "string", "const": "percentage" },
|
|
558
|
+
"value": {
|
|
559
|
+
"type": "number",
|
|
560
|
+
"description": "Discount percentage (0-100).",
|
|
561
|
+
"minimum": 0,
|
|
562
|
+
"maximum": 100,
|
|
563
|
+
"examples": [15]
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
"required": ["type", "value"]
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
"title": "Fixed Discount",
|
|
570
|
+
"type": "object",
|
|
571
|
+
"description": "A fixed-amount discount.",
|
|
572
|
+
"properties": {
|
|
573
|
+
"type": { "type": "string", "const": "fixed" },
|
|
574
|
+
"amount": {
|
|
575
|
+
"type": "number",
|
|
576
|
+
"description": "Discount amount in the transaction currency.",
|
|
577
|
+
"minimum": 0,
|
|
578
|
+
"examples": [10.0]
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
"required": ["type", "amount"]
|
|
582
|
+
}
|
|
583
|
+
]
|
|
584
|
+
},
|
|
585
|
+
"metadata": {
|
|
586
|
+
"type": "object",
|
|
587
|
+
"description": "Event metadata with oneOf at property level, containing if/then/else inside one of the oneOf branches.",
|
|
588
|
+
"properties": {
|
|
589
|
+
"timestamp": {
|
|
590
|
+
"type": "string",
|
|
591
|
+
"format": "date-time",
|
|
592
|
+
"description": "When the event occurred.",
|
|
593
|
+
"examples": ["2026-02-24T12:00:00Z"]
|
|
594
|
+
},
|
|
595
|
+
"source": {
|
|
596
|
+
"description": "Where the event originated — oneOf with if/then/else inside a branch.",
|
|
597
|
+
"oneOf": [
|
|
598
|
+
{
|
|
599
|
+
"title": "Web Source",
|
|
600
|
+
"type": "object",
|
|
601
|
+
"description": "Event from a web browser, with if/then/else based on device type.",
|
|
602
|
+
"required": ["platform", "device_type"],
|
|
603
|
+
"properties": {
|
|
604
|
+
"platform": { "type": "string", "const": "web" },
|
|
605
|
+
"device_type": {
|
|
606
|
+
"type": "string",
|
|
607
|
+
"description": "The type of device.",
|
|
608
|
+
"enum": ["desktop", "mobile", "tablet"],
|
|
609
|
+
"examples": ["desktop"]
|
|
610
|
+
},
|
|
611
|
+
"browser": {
|
|
612
|
+
"type": "string",
|
|
613
|
+
"description": "Browser name.",
|
|
614
|
+
"examples": ["Chrome"]
|
|
615
|
+
}
|
|
616
|
+
},
|
|
617
|
+
"if": {
|
|
618
|
+
"properties": { "device_type": { "const": "mobile" } },
|
|
619
|
+
"required": ["device_type"]
|
|
620
|
+
},
|
|
621
|
+
"then": {
|
|
622
|
+
"description": "Mobile web sessions include screen size and touch capability.",
|
|
623
|
+
"properties": {
|
|
624
|
+
"screen_width": {
|
|
625
|
+
"type": "integer",
|
|
626
|
+
"description": "Screen width in pixels.",
|
|
627
|
+
"examples": [390]
|
|
628
|
+
},
|
|
629
|
+
"touch_capable": {
|
|
630
|
+
"type": "boolean",
|
|
631
|
+
"description": "Whether the device supports touch.",
|
|
632
|
+
"examples": [true]
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
"else": {
|
|
637
|
+
"description": "Non-mobile web sessions include viewport dimensions.",
|
|
638
|
+
"properties": {
|
|
639
|
+
"viewport_width": {
|
|
640
|
+
"type": "integer",
|
|
641
|
+
"description": "Browser viewport width in pixels.",
|
|
642
|
+
"examples": [1920]
|
|
643
|
+
},
|
|
644
|
+
"viewport_height": {
|
|
645
|
+
"type": "integer",
|
|
646
|
+
"description": "Browser viewport height in pixels.",
|
|
647
|
+
"examples": [1080]
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
"title": "App Source",
|
|
654
|
+
"type": "object",
|
|
655
|
+
"description": "Event from a native app.",
|
|
656
|
+
"required": ["platform", "app_version"],
|
|
657
|
+
"properties": {
|
|
658
|
+
"platform": { "type": "string", "const": "app" },
|
|
659
|
+
"app_version": {
|
|
660
|
+
"type": "string",
|
|
661
|
+
"description": "Semantic version of the app.",
|
|
662
|
+
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$",
|
|
663
|
+
"examples": ["3.2.1"]
|
|
664
|
+
},
|
|
665
|
+
"os": {
|
|
666
|
+
"type": "string",
|
|
667
|
+
"description": "Operating system.",
|
|
668
|
+
"enum": ["ios", "android"],
|
|
669
|
+
"examples": ["ios"]
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
]
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
},
|
|
678
|
+
"if": {
|
|
679
|
+
"properties": {
|
|
680
|
+
"payment": {
|
|
681
|
+
"properties": {
|
|
682
|
+
"currency": { "const": "USD" }
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
"then": {
|
|
688
|
+
"description": "USD transactions require tax information. Demonstrates: if/then/else directly inside a then branch (if inside if).",
|
|
689
|
+
"properties": {
|
|
690
|
+
"tax": {
|
|
691
|
+
"type": "object",
|
|
692
|
+
"description": "US tax details.",
|
|
693
|
+
"properties": {
|
|
694
|
+
"rate": {
|
|
695
|
+
"type": "number",
|
|
696
|
+
"description": "Tax rate as a decimal (e.g. 0.0825 for 8.25%).",
|
|
697
|
+
"minimum": 0,
|
|
698
|
+
"maximum": 1,
|
|
699
|
+
"examples": [0.0825]
|
|
700
|
+
},
|
|
701
|
+
"amount": {
|
|
702
|
+
"type": "number",
|
|
703
|
+
"description": "Calculated tax amount.",
|
|
704
|
+
"minimum": 0,
|
|
705
|
+
"examples": [6.6]
|
|
706
|
+
},
|
|
707
|
+
"jurisdiction": {
|
|
708
|
+
"type": "string",
|
|
709
|
+
"description": "Tax jurisdiction (state).",
|
|
710
|
+
"examples": ["CA"]
|
|
711
|
+
}
|
|
712
|
+
},
|
|
713
|
+
"required": ["rate", "amount"]
|
|
714
|
+
}
|
|
715
|
+
},
|
|
716
|
+
"if": {
|
|
717
|
+
"description": "Check if tax jurisdiction is California.",
|
|
718
|
+
"properties": {
|
|
719
|
+
"tax": {
|
|
720
|
+
"properties": {
|
|
721
|
+
"jurisdiction": { "const": "CA" }
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
},
|
|
726
|
+
"then": {
|
|
727
|
+
"description": "California transactions require additional recycling fee info (if/then/else directly inside a then branch).",
|
|
728
|
+
"properties": {
|
|
729
|
+
"recycling_fee": {
|
|
730
|
+
"type": "object",
|
|
731
|
+
"description": "California recycling fee details.",
|
|
732
|
+
"properties": {
|
|
733
|
+
"applies": {
|
|
734
|
+
"type": "boolean",
|
|
735
|
+
"description": "Whether a recycling fee applies.",
|
|
736
|
+
"examples": [true]
|
|
737
|
+
},
|
|
738
|
+
"amount": {
|
|
739
|
+
"type": "number",
|
|
740
|
+
"description": "Recycling fee amount.",
|
|
741
|
+
"minimum": 0,
|
|
742
|
+
"examples": [1.5]
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
"required": ["applies"]
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
"else": {
|
|
750
|
+
"description": "Non-California USD transactions may include a state-specific exemption code.",
|
|
751
|
+
"properties": {
|
|
752
|
+
"state_exemption_code": {
|
|
753
|
+
"type": "string",
|
|
754
|
+
"description": "State-specific tax exemption code.",
|
|
755
|
+
"examples": ["TX-EXEMPT-001"]
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
},
|
|
760
|
+
"else": {
|
|
761
|
+
"description": "Non-USD transactions may include a VAT number.",
|
|
762
|
+
"properties": {
|
|
763
|
+
"vat_number": {
|
|
764
|
+
"type": "string",
|
|
765
|
+
"description": "EU VAT identification number.",
|
|
766
|
+
"pattern": "^[A-Z]{2}[0-9A-Z]+$",
|
|
767
|
+
"examples": ["DE123456789"]
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
}
|