apicize_lib 0.35.1

Library supporting Apicize request dispatch, testing and serialization
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://apicize.com/schemas/workbook.json",
  "title": "Apicize Workbook",
  "description": "Schema for Apicize workbook files (.apicize)",
  "type": "object",
  "required": ["version", "requests"],
  "additionalProperties": false,
  "properties": {
    "version": {
      "type": "number",
      "description": "Version of workbook format (should not be changed manually)"
    },
    "requests": {
      "type": "array",
      "description": "List of requests and request groups",
      "items": {
        "$ref": "#/$defs/RequestEntry"
      }
    },
    "scenarios": {
      "type": "array",
      "description": "Workbook scenarios",
      "items": {
        "$ref": "#/$defs/Scenario"
      }
    },
    "authorizations": {
      "type": "array",
      "description": "Workbook authorizations",
      "items": {
        "$ref": "#/$defs/Authorization"
      }
    },
    "certificates": {
      "type": "array",
      "description": "Workbook certificates",
      "items": {
        "$ref": "#/$defs/Certificate"
      }
    },
    "proxies": {
      "type": "array",
      "description": "Workbook proxy servers",
      "items": {
        "$ref": "#/$defs/Proxy"
      }
    },
    "data": {
      "type": "array",
      "description": "Workbook data sets",
      "items": {
        "$ref": "#/$defs/DataSet"
      }
    },
    "defaults": {
      "$ref": "#/$defs/WorkbookDefaults",
      "description": "Workbook default parameter selections"
    }
  },
  "$defs": {
    "RequestEntry": {
      "description": "Either a request or a request group",
      "oneOf": [
        { "$ref": "#/$defs/Request" },
        { "$ref": "#/$defs/RequestGroup" }
      ]
    },
    "Request": {
      "type": "object",
      "description": "An HTTP request definition",
      "required": ["id", "name", "url"],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier (UUID)"
        },
        "name": {
          "type": "string",
          "description": "Display name of the request"
        },
        "disabled": {
          "type": "boolean",
          "description": "Whether the request is disabled",
          "default": false
        },
        "key": {
          "type": "string",
          "description": "Optional key identifier"
        },
        "test": {
          "type": "string",
          "description": "JavaScript test code to run against the response"
        },
        "url": {
          "type": "string",
          "description": "Request URL (supports {{variable}} substitution)"
        },
        "method": {
          "$ref": "#/$defs/RequestMethod"
        },
        "timeout": {
          "type": "integer",
          "description": "Request timeout in milliseconds",
          "minimum": 0
        },
        "headers": {
          "type": "array",
          "description": "HTTP request headers",
          "items": {
            "$ref": "#/$defs/NameValuePair"
          }
        },
        "queryStringParams": {
          "type": "array",
          "description": "URL query string parameters",
          "items": {
            "$ref": "#/$defs/NameValuePair"
          }
        },
        "body": {
          "$ref": "#/$defs/RequestBody"
        },
        "keepAlive": {
          "type": "boolean",
          "description": "Whether to use HTTP keep-alive",
          "default": false
        },
        "acceptInvalidCerts": {
          "type": "boolean",
          "description": "Whether to accept invalid SSL certificates",
          "default": false
        },
        "numberOfRedirects": {
          "type": "integer",
          "description": "Maximum number of HTTP redirects to follow",
          "default": 10,
          "minimum": 0
        },
        "runs": {
          "type": "integer",
          "description": "Number of times to execute the request",
          "default": 1,
          "minimum": 1
        },
        "multiRunExecution": {
          "$ref": "#/$defs/ExecutionConcurrency",
          "description": "How multiple runs are executed",
          "default": "SEQUENTIAL"
        },
        "selectedScenario": {
          "$ref": "#/$defs/Selection",
          "description": "Selected scenario for this request"
        },
        "selectedAuthorization": {
          "$ref": "#/$defs/Selection",
          "description": "Selected authorization for this request"
        },
        "selectedCertificate": {
          "$ref": "#/$defs/Selection",
          "description": "Selected certificate for this request"
        },
        "selectedProxy": {
          "$ref": "#/$defs/Selection",
          "description": "Selected proxy for this request"
        },
        "selectedData": {
          "$ref": "#/$defs/Selection",
          "description": "Selected data set for this request"
        }
      }
    },
    "RequestGroup": {
      "type": "object",
      "description": "A group of requests executed together",
      "required": ["id", "name", "children"],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier (UUID)"
        },
        "name": {
          "type": "string",
          "description": "Display name of the group"
        },
        "disabled": {
          "type": "boolean",
          "description": "Whether the group is disabled",
          "default": false
        },
        "key": {
          "type": "string",
          "description": "Optional key identifier"
        },
        "children": {
          "type": "array",
          "description": "Child requests and groups",
          "items": {
            "$ref": "#/$defs/RequestEntry"
          }
        },
        "execution": {
          "$ref": "#/$defs/ExecutionConcurrency",
          "description": "How child requests are executed",
          "default": "SEQUENTIAL"
        },
        "runs": {
          "type": "integer",
          "description": "Number of times to execute the group",
          "default": 1,
          "minimum": 1
        },
        "multiRunExecution": {
          "$ref": "#/$defs/ExecutionConcurrency",
          "description": "How multiple runs are executed",
          "default": "SEQUENTIAL"
        },
        "setup": {
          "type": "string",
          "description": "JavaScript setup code to run before group execution"
        },
        "selectedScenario": {
          "$ref": "#/$defs/Selection",
          "description": "Selected scenario for this group"
        },
        "selectedAuthorization": {
          "$ref": "#/$defs/Selection",
          "description": "Selected authorization for this group"
        },
        "selectedCertificate": {
          "$ref": "#/$defs/Selection",
          "description": "Selected certificate for this group"
        },
        "selectedProxy": {
          "$ref": "#/$defs/Selection",
          "description": "Selected proxy for this group"
        },
        "selectedData": {
          "$ref": "#/$defs/Selection",
          "description": "Selected data set for this group"
        }
      }
    },
    "RequestMethod": {
      "type": "string",
      "description": "HTTP request method",
      "enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]
    },
    "ExecutionConcurrency": {
      "type": "string",
      "description": "Execution concurrency mode",
      "enum": ["SEQUENTIAL", "CONCURRENT"]
    },
    "RequestBody": {
      "description": "Request body content",
      "oneOf": [
        { "$ref": "#/$defs/TextBody" },
        { "$ref": "#/$defs/JSONBody" },
        { "$ref": "#/$defs/XMLBody" },
        { "$ref": "#/$defs/FormBody" },
        { "$ref": "#/$defs/RawBody" }
      ],
      "discriminator": {
        "propertyName": "type"
      }
    },
    "TextBody": {
      "type": "object",
      "description": "Plain text request body",
      "required": ["type", "data"],
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "Text"
        },
        "data": {
          "type": "string",
          "description": "Text content"
        }
      }
    },
    "JSONBody": {
      "type": "object",
      "description": "JSON request body",
      "required": ["type"],
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "JSON"
        },
        "data": {
          "description": "Parsed JSON data (any valid JSON value)"
        },
        "formatted": {
          "type": "string",
          "description": "Formatted/pretty-printed JSON string representation"
        }
      }
    },
    "XMLBody": {
      "type": "object",
      "description": "XML request body",
      "required": ["type"],
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "XML"
        },
        "formatted": {
          "type": "string",
          "description": "Formatted XML string"
        }
      }
    },
    "FormBody": {
      "type": "object",
      "description": "Form-encoded request body",
      "required": ["type", "data"],
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "Form"
        },
        "data": {
          "type": "array",
          "description": "Form field name-value pairs",
          "items": {
            "$ref": "#/$defs/NameValuePair"
          }
        }
      }
    },
    "RawBody": {
      "type": "object",
      "description": "Raw binary request body (base64 encoded)",
      "required": ["type", "data"],
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "Raw"
        },
        "data": {
          "type": "string",
          "description": "Base64-encoded binary data (standard alphabet, unpadded)",
          "contentEncoding": "base64"
        }
      }
    },
    "NameValuePair": {
      "type": "object",
      "description": "A name-value pair (used for headers, query params, form fields)",
      "required": ["name", "value"],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string"
        },
        "value": {
          "type": "string"
        },
        "disabled": {
          "type": "boolean",
          "description": "Whether this pair is disabled"
        }
      }
    },
    "Selection": {
      "type": "object",
      "description": "A reference to a selected entity by ID and name",
      "required": ["id"],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "description": "ID of the selected entity"
        },
        "name": {
          "type": "string",
          "description": "Display name of the selected entity",
          "default": ""
        }
      }
    },
    "Scenario": {
      "type": "object",
      "description": "A scenario with variable definitions for parameterized testing",
      "required": ["id", "name"],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier (UUID)"
        },
        "name": {
          "type": "string",
          "description": "Display name of the scenario"
        },
        "variables": {
          "type": "array",
          "description": "Variables defined in this scenario",
          "items": {
            "$ref": "#/$defs/Variable"
          }
        }
      }
    },
    "Variable": {
      "type": "object",
      "description": "A variable with a name, type, and value",
      "required": ["name", "value"],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "description": "Variable name"
        },
        "type": {
          "type": "string",
          "description": "Variable source type",
          "enum": ["TEXT", "JSON", "FILE-JSON", "FILE-CSV"],
          "default": "TEXT"
        },
        "value": {
          "type": "string",
          "description": "Variable value (or file path for FILE-* types)"
        },
        "disabled": {
          "type": "boolean",
          "description": "Whether this variable is disabled"
        }
      }
    },
    "Authorization": {
      "description": "Authentication configuration",
      "oneOf": [
        { "$ref": "#/$defs/BasicAuth" },
        { "$ref": "#/$defs/OAuth2ClientAuth" },
        { "$ref": "#/$defs/OAuth2PkceAuth" },
        { "$ref": "#/$defs/ApiKeyAuth" }
      ],
      "discriminator": {
        "propertyName": "type"
      }
    },
    "BasicAuth": {
      "type": "object",
      "description": "HTTP Basic authentication",
      "required": ["type", "id", "name", "username", "password"],
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "Basic"
        },
        "id": {
          "type": "string",
          "description": "Unique identifier (UUID)"
        },
        "name": {
          "type": "string",
          "description": "Display name"
        },
        "username": {
          "type": "string",
          "description": "Basic auth username"
        },
        "password": {
          "type": "string",
          "description": "Basic auth password"
        }
      }
    },
    "OAuth2ClientAuth": {
      "type": "object",
      "description": "OAuth2 Client Credentials authentication",
      "required": ["type", "id", "name", "accessTokenUrl", "clientId", "clientSecret"],
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "OAuth2Client"
        },
        "id": {
          "type": "string",
          "description": "Unique identifier (UUID)"
        },
        "name": {
          "type": "string",
          "description": "Display name"
        },
        "accessTokenUrl": {
          "type": "string",
          "description": "URL to obtain access token"
        },
        "clientId": {
          "type": "string",
          "description": "OAuth2 client ID"
        },
        "clientSecret": {
          "type": "string",
          "description": "OAuth2 client secret"
        },
        "audience": {
          "type": "string",
          "description": "OAuth2 audience"
        },
        "scope": {
          "type": "string",
          "description": "OAuth2 scope"
        },
        "selectedCertificate": {
          "$ref": "#/$defs/Selection",
          "description": "Certificate to use for token request"
        },
        "selectedProxy": {
          "$ref": "#/$defs/Selection",
          "description": "Proxy to use for token request"
        },
        "sendCredentialsInBody": {
          "type": "boolean",
          "description": "Whether to send credentials in request body instead of header"
        }
      }
    },
    "OAuth2PkceAuth": {
      "type": "object",
      "description": "OAuth2 PKCE (Authorization Code with PKCE) authentication",
      "required": ["type", "id", "name", "authorizeUrl", "accessTokenUrl", "clientId"],
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "OAuth2Pkce"
        },
        "id": {
          "type": "string",
          "description": "Unique identifier (UUID)"
        },
        "name": {
          "type": "string",
          "description": "Display name"
        },
        "authorizeUrl": {
          "type": "string",
          "description": "Authorization endpoint URL"
        },
        "accessTokenUrl": {
          "type": "string",
          "description": "Token endpoint URL"
        },
        "clientId": {
          "type": "string",
          "description": "OAuth2 client ID"
        },
        "scope": {
          "type": "string",
          "description": "OAuth2 scope"
        },
        "sendCredentialsInBody": {
          "type": "boolean",
          "description": "Whether to send credentials in request body instead of header"
        }
      }
    },
    "ApiKeyAuth": {
      "type": "object",
      "description": "API Key authentication via header",
      "required": ["type", "id", "name", "header", "value"],
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "ApiKey"
        },
        "id": {
          "type": "string",
          "description": "Unique identifier (UUID)"
        },
        "name": {
          "type": "string",
          "description": "Display name"
        },
        "header": {
          "type": "string",
          "description": "Header name to send the API key in"
        },
        "value": {
          "type": "string",
          "description": "API key value"
        }
      }
    },
    "Certificate": {
      "description": "TLS client certificate configuration",
      "oneOf": [
        { "$ref": "#/$defs/PKCS12Certificate" },
        { "$ref": "#/$defs/PKCS8PEMCertificate" },
        { "$ref": "#/$defs/PEMCertificate" }
      ],
      "discriminator": {
        "propertyName": "type"
      }
    },
    "PKCS12Certificate": {
      "type": "object",
      "description": "PKCS#12 (.pfx/.p12) certificate",
      "required": ["type", "id", "name", "pfx"],
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "PKCS12"
        },
        "id": {
          "type": "string",
          "description": "Unique identifier (UUID)"
        },
        "name": {
          "type": "string",
          "description": "Display name"
        },
        "pfx": {
          "type": "string",
          "description": "Base64-encoded PKCS#12 data (standard alphabet, unpadded)",
          "contentEncoding": "base64"
        },
        "password": {
          "type": "string",
          "description": "Password for the PKCS#12 file"
        }
      }
    },
    "PKCS8PEMCertificate": {
      "type": "object",
      "description": "PKCS#8 PEM certificate with separate key",
      "required": ["type", "id", "name", "pem", "key"],
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "PKCS8_PEM"
        },
        "id": {
          "type": "string",
          "description": "Unique identifier (UUID)"
        },
        "name": {
          "type": "string",
          "description": "Display name"
        },
        "pem": {
          "type": "string",
          "description": "Base64-encoded PEM certificate data (standard alphabet, unpadded)",
          "contentEncoding": "base64"
        },
        "key": {
          "type": "string",
          "description": "Base64-encoded PKCS#8 private key data (standard alphabet, unpadded)",
          "contentEncoding": "base64"
        }
      }
    },
    "PEMCertificate": {
      "type": "object",
      "description": "PEM certificate (no separate key)",
      "required": ["type", "id", "name", "pem"],
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "PEM"
        },
        "id": {
          "type": "string",
          "description": "Unique identifier (UUID)"
        },
        "name": {
          "type": "string",
          "description": "Display name"
        },
        "pem": {
          "type": "string",
          "description": "Base64-encoded PEM certificate data (standard alphabet, unpadded)",
          "contentEncoding": "base64"
        }
      }
    },
    "Proxy": {
      "type": "object",
      "description": "Proxy server configuration",
      "required": ["id", "name", "url"],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier (UUID)"
        },
        "name": {
          "type": "string",
          "description": "Display name"
        },
        "url": {
          "type": "string",
          "description": "Proxy server URL"
        }
      }
    },
    "DataSet": {
      "type": "object",
      "description": "External data set for parameterized testing",
      "required": ["id", "name", "type", "source"],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier (UUID)"
        },
        "name": {
          "type": "string",
          "description": "Display name"
        },
        "type": {
          "type": "string",
          "description": "Data source type",
          "enum": ["JSON", "FILE-JSON", "FILE-CSV"]
        },
        "source": {
          "type": "string",
          "description": "Data source content (for JSON type) or file path (for FILE-* types)"
        }
      }
    },
    "WorkbookDefaults": {
      "type": "object",
      "description": "Default parameter selections for the workbook",
      "additionalProperties": false,
      "properties": {
        "selectedScenario": {
          "$ref": "#/$defs/Selection",
          "description": "Default scenario selection"
        },
        "selectedAuthorization": {
          "$ref": "#/$defs/Selection",
          "description": "Default authorization selection"
        },
        "selectedCertificate": {
          "$ref": "#/$defs/Selection",
          "description": "Default certificate selection"
        },
        "selectedProxy": {
          "$ref": "#/$defs/Selection",
          "description": "Default proxy selection"
        },
        "selectedData": {
          "$ref": "#/$defs/Selection",
          "description": "Default data set selection"
        }
      }
    }
  }
}