-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathschema.json
More file actions
426 lines (426 loc) · 12 KB
/
Copy pathschema.json
File metadata and controls
426 lines (426 loc) · 12 KB
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
{
"$id": "https://raw.githubusercontent.com/evg4b/uncors/main/schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"definitions": {
"HARConfig": {
"description": "HAR (HTTP Archive) collector configuration. Records all proxied request/response pairs to a file in HAR 1.2 format.",
"oneOf": [
{
"description": "Short form: path to the output HAR file",
"type": "string",
"examples": [
"./recordings/api.har",
"/tmp/trace.har"
]
},
{
"additionalProperties": false,
"description": "Full form with all options",
"properties": {
"capture-secure-headers": {
"default": false,
"description": "Include security-sensitive headers in HAR entries. When false (default), Cookie, Set-Cookie, Authorization, WWW-Authenticate, Proxy-Authorization and Proxy-Authenticate headers are excluded.",
"type": "boolean"
},
"file": {
"description": "Path to the output HAR file",
"type": "string"
}
},
"required": [
"file"
],
"type": "object"
}
]
},
"Duration": {
"description": "Duration in human-readable format. Supported units are 'h' (hours), 'm' (minutes), 's' (seconds), 'ms' (milliseconds), 'us' (microseconds), 'ns' (nanoseconds).",
"examples": [
"3s",
"1m 30s",
"500ms",
"1h 30m 15s 500ms 100us 200ns"
],
"pattern": "^(\\d+h)?\\s*(\\d+m)?\\s*(\\d+s)?\\s*(\\d+ms)?\\s*(\\d+(us|µs))?\\s*(\\d+(ns))?$",
"title": "Duration",
"type": "string"
},
"FileMockResponse": {
"additionalProperties": false,
"description": "Mock response definition based on file content",
"properties": {
"code": {
"$ref": "#/definitions/StatusCode",
"description": "HTTP status code which will be sent in the mock response"
},
"delay": {
"$ref": "#/definitions/Duration",
"description": "Delay before sending the mock response"
},
"file": {
"description": "Path to the file whose content will be sent in the mock response",
"type": "string"
},
"headers": {
"$ref": "#/definitions/Headers",
"description": "HTTP headers which will be sent in the mock response"
}
},
"required": [
"code",
"file"
],
"type": "object"
},
"Headers": {
"additionalProperties": {
"type": "string"
},
"description": "HTTP headers definition",
"minProperties": 1,
"type": "object"
},
"Mapping": {
"oneOf": [
{
"additionalProperties": {
"type": "string"
},
"description": "Host mapping definition",
"maxProperties": 1,
"minProperties": 1,
"type": "object"
},
{
"additionalProperties": false,
"description": "Host mapping definition",
"properties": {
"cache": {
"description": "List the paths that will be cached.",
"items": {
"type": "string"
},
"minItems": 1,
"type": "array"
},
"from": {
"description": "The local host with protocol and port for the resource from which proxying will take place (e.g., http://localhost:8080). Port defaults to 80 for HTTP and 443 for HTTPS if not specified. HTTPS mappings use auto-generated certificates (requires CA certificate generated with 'uncors generate-certs').",
"type": "string"
},
"har": {
"$ref": "#/definitions/HARConfig",
"description": "HAR collector configuration. When set, all requests for this mapping are recorded to the specified HAR file."
},
"mocks": {
"description": "List the mocked requests",
"items": {
"$ref": "#/definitions/Mock"
},
"minItems": 1,
"type": "array"
},
"options-handling": {
"$ref": "#/definitions/OptionsHandling"
},
"rewrites": {
"description": "List of paths that will be rewritten.",
"items": {
"$ref": "#/definitions/Rewrite"
},
"minItems": 1,
"type": "array"
},
"scripts": {
"description": "List of script handlers",
"items": {
"$ref": "#/definitions/Script"
},
"minItems": 1,
"type": "array"
},
"statics": {
"description": "List of paths that will be served from the directory.",
"items": {
"$ref": "#/definitions/StaticDirectory"
},
"minItems": 1,
"type": "array"
},
"to": {
"description": "The target host and protocol for the resource that needs to be proxied",
"type": "string"
}
},
"required": [
"from",
"to"
],
"type": "object"
}
]
},
"Method": {
"enum": [
"GET",
"HEAD",
"POST",
"PUT",
"DELETE",
"CONNECT",
"OPTIONS",
"TRACE",
"PATCH"
],
"type": "string"
},
"Mock": {
"additionalProperties": false,
"description": "Mocked request definition",
"properties": {
"headers": {
"$ref": "#/definitions/Headers",
"description": "Mocked request headers"
},
"method": {
"$ref": "#/definitions/Method",
"description": "Mocked request method"
},
"path": {
"description": "Mocked request path",
"type": "string"
},
"queries": {
"$ref": "#/definitions/Queries",
"description": "Mocked request queries"
},
"response": {
"description": "Mock response definition",
"oneOf": [
{
"$ref": "#/definitions/RawMockResponse"
},
{
"$ref": "#/definitions/FileMockResponse"
}
]
}
},
"required": [
"path",
"response"
],
"type": "object"
},
"OptionsHandling": {
"description": "OPTIONS request handling configuration",
"properties": {
"disabled": {
"default": false,
"description": "Disable OPTIONS request handling and all requests will be proxied to the target server",
"type": "boolean"
},
"headers": {
"$ref": "#/definitions/Headers",
"description": "Custom headers to be sent in response to OPTIONS requests"
},
"status": {
"$ref": "#/definitions/StatusCode",
"description": "Custom status code to be sent in response to OPTIONS requests"
}
},
"type": "object"
},
"Queries": {
"additionalProperties": {
"type": "string"
},
"description": "HTTP query parameters definition",
"minProperties": 1,
"type": "object"
},
"RawMockResponse": {
"additionalProperties": false,
"description": "Mock response definition based on raw content",
"properties": {
"code": {
"$ref": "#/definitions/StatusCode"
},
"delay": {
"$ref": "#/definitions/Duration",
"description": "Delay before sending the mock response"
},
"headers": {
"$ref": "#/definitions/Headers",
"description": "HTTP headers which will be sent in the mock response"
},
"raw": {
"description": "Content which will be sent in the mock response",
"type": "string"
}
},
"required": [
"code",
"raw"
],
"type": "object"
},
"Rewrite": {
"additionalProperties": false,
"properties": {
"from": {
"type": "string"
},
"host": {
"type": "string"
},
"to": {
"type": "string"
}
},
"required": [
"from",
"to"
],
"type": "object"
},
"Script": {
"additionalProperties": false,
"description": "Script request handler definition",
"oneOf": [
{
"not": {
"required": [
"file"
]
},
"required": [
"script"
]
},
{
"not": {
"required": [
"script"
]
},
"required": [
"file"
]
}
],
"properties": {
"file": {
"description": "Path to script file",
"type": "string"
},
"headers": {
"$ref": "#/definitions/Headers",
"description": "Request headers to match"
},
"method": {
"$ref": "#/definitions/Method",
"description": "Request method to match"
},
"path": {
"description": "Request path to handle with script",
"type": "string"
},
"queries": {
"$ref": "#/definitions/Queries",
"description": "Request query parameters to match"
},
"script": {
"description": "Inline script code",
"type": "string"
}
},
"required": [
"path"
],
"type": "object"
},
"StaticDirectory": {
"additionalProperties": false,
"description": "Static serving directory definition",
"properties": {
"dir": {
"description": "Path to the folder from which the static files will be served",
"type": "string"
},
"index": {
"default": "",
"description": "The file witch will be returned if the requested file is not found. It should be a relative path within the dir folder",
"type": "string"
},
"path": {
"description": "Path where the static files will be served",
"type": "string"
}
},
"required": [
"path",
"dir"
],
"type": "object"
},
"StatusCode": {
"description": "HTTP response status code",
"examples": [
200,
404,
500
],
"maximum": 599,
"minimum": 100,
"type": "integer"
}
},
"description": "Configuration file for uncors reverse proxy",
"properties": {
"cache-config": {
"additionalProperties": false,
"description": "Global cache configuration",
"properties": {
"clear-time": {
"description": "Expired cache clear time",
"type": "string"
},
"expiration-time": {
"description": "Cache expiration time",
"type": "string"
},
"methods": {
"default": [
"GET"
],
"description": "List of http methods with can be cached",
"items": {
"$ref": "#/definitions/Method"
},
"type": "array"
}
},
"type": "object"
},
"mappings": {
"description": "A list of mappings that describe how to forward requests. Ports are specified in the 'from' URL (e.g., http://localhost:8080).",
"items": {
"$ref": "#/definitions/Mapping"
},
"minItems": 1,
"type": "array"
},
"proxy": {
"description": "HTTP/HTTPS proxy to provide requests to real server (used system by default)",
"format": "uri",
"type": "string"
}
},
"required": [
"mappings"
],
"title": "Uncors configuration",
"type": "object"
}