fastify 3.26.0 → 4.0.0-alpha.1

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.
Files changed (129) hide show
  1. package/README.md +5 -4
  2. package/build/build-error-serializer.js +27 -0
  3. package/build/build-validation.js +49 -35
  4. package/docs/Guides/Ecosystem.md +2 -1
  5. package/docs/Guides/Prototype-Poisoning.md +3 -3
  6. package/docs/Migration-Guide-V4.md +12 -0
  7. package/docs/Reference/ContentTypeParser.md +8 -1
  8. package/docs/Reference/Errors.md +51 -6
  9. package/docs/Reference/Hooks.md +4 -7
  10. package/docs/Reference/LTS.md +5 -4
  11. package/docs/Reference/Reply.md +23 -22
  12. package/docs/Reference/Request.md +1 -3
  13. package/docs/Reference/Routes.md +17 -10
  14. package/docs/Reference/Server.md +98 -63
  15. package/docs/Reference/TypeScript.md +11 -13
  16. package/docs/Reference/Validation-and-Serialization.md +32 -54
  17. package/docs/Type-Providers.md +257 -0
  18. package/examples/hooks.js +1 -1
  19. package/examples/simple-stream.js +18 -0
  20. package/fastify.d.ts +36 -22
  21. package/fastify.js +72 -53
  22. package/lib/configValidator.js +902 -1023
  23. package/lib/contentTypeParser.js +6 -16
  24. package/lib/context.js +36 -10
  25. package/lib/decorate.js +5 -3
  26. package/lib/error-handler.js +158 -0
  27. package/lib/error-serializer.js +257 -0
  28. package/lib/errors.js +49 -10
  29. package/lib/fourOhFour.js +31 -20
  30. package/lib/handleRequest.js +10 -13
  31. package/lib/hooks.js +14 -9
  32. package/lib/noop-set.js +10 -0
  33. package/lib/pluginOverride.js +0 -3
  34. package/lib/pluginUtils.js +3 -2
  35. package/lib/reply.js +44 -163
  36. package/lib/request.js +13 -10
  37. package/lib/route.js +158 -139
  38. package/lib/schema-controller.js +3 -3
  39. package/lib/schemas.js +27 -1
  40. package/lib/server.js +219 -116
  41. package/lib/symbols.js +6 -4
  42. package/lib/validation.js +2 -1
  43. package/lib/warnings.js +2 -12
  44. package/lib/wrapThenable.js +4 -11
  45. package/package.json +40 -45
  46. package/test/404s.test.js +265 -108
  47. package/test/500s.test.js +2 -2
  48. package/test/async-await.test.js +15 -71
  49. package/test/close.test.js +39 -1
  50. package/test/content-parser.test.js +32 -0
  51. package/test/context-config.test.js +56 -4
  52. package/test/custom-http-server.test.js +14 -7
  53. package/test/custom-parser-async.test.js +0 -65
  54. package/test/custom-parser.test.js +54 -121
  55. package/test/decorator.test.js +1 -3
  56. package/test/delete.test.js +5 -5
  57. package/test/encapsulated-error-handler.test.js +50 -0
  58. package/test/esm/index.test.js +0 -14
  59. package/test/fastify-instance.test.js +4 -4
  60. package/test/fluent-schema.test.js +4 -4
  61. package/test/get.test.js +3 -3
  62. package/test/helper.js +18 -3
  63. package/test/hooks-async.test.js +14 -47
  64. package/test/hooks.on-ready.test.js +9 -4
  65. package/test/hooks.test.js +58 -99
  66. package/test/http2/closing.test.js +5 -11
  67. package/test/http2/unknown-http-method.test.js +3 -9
  68. package/test/https/custom-https-server.test.js +12 -6
  69. package/test/inject.test.js +1 -1
  70. package/test/input-validation.js +2 -2
  71. package/test/internals/all.test.js +2 -2
  72. package/test/internals/contentTypeParser.test.js +4 -4
  73. package/test/internals/handleRequest.test.js +9 -46
  74. package/test/internals/initialConfig.test.js +33 -12
  75. package/test/internals/logger.test.js +1 -1
  76. package/test/internals/reply.test.js +245 -3
  77. package/test/internals/request.test.js +13 -7
  78. package/test/internals/server.test.js +88 -0
  79. package/test/listen.test.js +84 -1
  80. package/test/logger.test.js +98 -58
  81. package/test/maxRequestsPerSocket.test.js +8 -6
  82. package/test/middleware.test.js +2 -25
  83. package/test/noop-set.test.js +19 -0
  84. package/test/nullable-validation.test.js +51 -14
  85. package/test/plugin.test.js +31 -5
  86. package/test/pretty-print.test.js +22 -10
  87. package/test/reply-error.test.js +123 -12
  88. package/test/request-error.test.js +2 -5
  89. package/test/route-hooks.test.js +17 -17
  90. package/test/route-prefix.test.js +2 -1
  91. package/test/route.test.js +216 -20
  92. package/test/router-options.test.js +1 -1
  93. package/test/schema-examples.test.js +11 -5
  94. package/test/schema-feature.test.js +24 -19
  95. package/test/schema-serialization.test.js +50 -9
  96. package/test/schema-special-usage.test.js +14 -81
  97. package/test/schema-validation.test.js +9 -9
  98. package/test/skip-reply-send.test.js +8 -8
  99. package/test/stream.test.js +23 -12
  100. package/test/throw.test.js +8 -5
  101. package/test/trust-proxy.test.js +1 -1
  102. package/test/type-provider.test.js +20 -0
  103. package/test/types/fastify.test-d.ts +12 -18
  104. package/test/types/hooks.test-d.ts +7 -3
  105. package/test/types/import.js +2 -0
  106. package/test/types/import.ts +1 -0
  107. package/test/types/instance.test-d.ts +61 -15
  108. package/test/types/logger.test-d.ts +44 -15
  109. package/test/types/route.test-d.ts +8 -2
  110. package/test/types/schema.test-d.ts +2 -39
  111. package/test/types/type-provider.test-d.ts +417 -0
  112. package/test/validation-error-handling.test.js +9 -9
  113. package/test/versioned-routes.test.js +29 -17
  114. package/test/wrapThenable.test.js +7 -6
  115. package/types/.eslintrc.json +1 -1
  116. package/types/content-type-parser.d.ts +17 -8
  117. package/types/hooks.d.ts +107 -60
  118. package/types/instance.d.ts +137 -105
  119. package/types/logger.d.ts +18 -104
  120. package/types/plugin.d.ts +10 -4
  121. package/types/register.d.ts +1 -1
  122. package/types/reply.d.ts +16 -11
  123. package/types/request.d.ts +10 -5
  124. package/types/route.d.ts +42 -31
  125. package/types/schema.d.ts +15 -1
  126. package/types/type-provider.d.ts +99 -0
  127. package/types/utils.d.ts +1 -1
  128. package/lib/schema-compilers.js +0 -12
  129. package/test/emit-warning.test.js +0 -166
@@ -1,1028 +1,907 @@
1
1
  // This file is autogenerated by build/build-validation.js, do not edit
2
2
  /* istanbul ignore file */
3
- // constant needed for customRule0 to work
4
- const self = {}
3
+ "use strict";
4
+ module.exports = validate10;
5
+ module.exports.default = validate10;
6
+ const schema11 = {"type":"object","additionalProperties":false,"properties":{"connectionTimeout":{"type":"integer","default":0},"keepAliveTimeout":{"type":"integer","default":72000},"forceCloseConnections":{"type":"boolean","default":false},"maxRequestsPerSocket":{"type":"integer","default":0,"nullable":true},"requestTimeout":{"type":"integer","default":0},"bodyLimit":{"type":"integer","default":1048576},"caseSensitive":{"type":"boolean","default":true},"http2":{"type":"boolean"},"https":{"if":{"not":{"oneOf":[{"type":"boolean"},{"type":"null"},{"type":"object","additionalProperties":false,"required":["allowHTTP1"],"properties":{"allowHTTP1":{"type":"boolean"}}}]}},"then":{"setDefaultValue":true}},"ignoreTrailingSlash":{"type":"boolean","default":false},"disableRequestLogging":{"type":"boolean","default":false},"jsonShorthand":{"type":"boolean","default":true},"maxParamLength":{"type":"integer","default":100},"onProtoPoisoning":{"type":"string","default":"error"},"onConstructorPoisoning":{"type":"string","default":"error"},"pluginTimeout":{"type":"integer","default":10000},"requestIdHeader":{"type":"string","default":"request-id"},"requestIdLogLabel":{"type":"string","default":"reqId"},"http2SessionTimeout":{"type":"integer","default":72000},"exposeHeadRoutes":{"type":"boolean","default":true},"versioning":{"type":"object","additionalProperties":true,"required":["storage","deriveVersion"],"properties":{"storage":{},"deriveVersion":{}}},"constraints":{"type":"object","additionalProperties":{"type":"object","required":["name","storage","validate","deriveConstraint"],"additionalProperties":true,"properties":{"name":{"type":"string"},"storage":{},"validate":{},"deriveConstraint":{}}}}}};
7
+ const func4 = Object.prototype.hasOwnProperty;
5
8
 
6
- 'use strict';
7
- var validate = (function() {
8
- var refVal = [];
9
- return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
10
- 'use strict';
11
- var vErrors = null;
12
- var errors = 0;
13
- if (rootData === undefined) rootData = data;
14
- if ((data && typeof data === "object" && !Array.isArray(data))) {
15
- if (data.connectionTimeout === undefined) data.connectionTimeout = 0;
16
- if (data.keepAliveTimeout === undefined) data.keepAliveTimeout = 5000;
17
- if (data.maxRequestsPerSocket === undefined) data.maxRequestsPerSocket = 0;
18
- if (data.requestTimeout === undefined) data.requestTimeout = 0;
19
- if (data.bodyLimit === undefined) data.bodyLimit = 1048576;
20
- if (data.caseSensitive === undefined) data.caseSensitive = true;
21
- if (data.ignoreTrailingSlash === undefined) data.ignoreTrailingSlash = false;
22
- if (data.disableRequestLogging === undefined) data.disableRequestLogging = false;
23
- if (data.jsonShorthand === undefined) data.jsonShorthand = true;
24
- if (data.maxParamLength === undefined) data.maxParamLength = 100;
25
- if (data.onProtoPoisoning === undefined) data.onProtoPoisoning = "error";
26
- if (data.onConstructorPoisoning === undefined) data.onConstructorPoisoning = "error";
27
- if (data.pluginTimeout === undefined) data.pluginTimeout = 10000;
28
- if (data.requestIdHeader === undefined) data.requestIdHeader = "request-id";
29
- if (data.requestIdLogLabel === undefined) data.requestIdLogLabel = "reqId";
30
- if (data.http2SessionTimeout === undefined) data.http2SessionTimeout = 5000;
31
- var errs__0 = errors;
32
- var valid1 = true;
33
- for (var key0 in data) {
34
- var isAdditional0 = !(false || validate.schema.properties.hasOwnProperty(key0));
35
- if (isAdditional0) {
36
- delete data[key0];
37
- }
38
- }
39
- if (valid1) {
40
- var data1 = data.connectionTimeout;
41
- var errs_1 = errors;
42
- if ((typeof data1 !== "number" || (data1 % 1) || data1 !== data1)) {
43
- var dataType1 = typeof data1;
44
- var coerced1 = undefined;
45
- if (coerced1 !== undefined);
46
- else if (dataType1 == 'boolean' || data1 === null || (dataType1 == 'string' && data1 && data1 == +data1 && !(data1 % 1))) coerced1 = +data1;
47
- else {
48
- validate.errors = [{
49
- keyword: 'type',
50
- dataPath: (dataPath || '') + '.connectionTimeout',
51
- schemaPath: '#/properties/connectionTimeout/type',
52
- params: {
53
- type: 'integer'
54
- },
55
- message: 'should be integer'
56
- }];
57
- return false;
58
- }
59
- if (coerced1 !== undefined) {
60
- data1 = coerced1;
61
- data['connectionTimeout'] = coerced1;
62
- }
63
- }
64
- var valid1 = errors === errs_1;
65
- if (valid1) {
66
- var data1 = data.keepAliveTimeout;
67
- var errs_1 = errors;
68
- if ((typeof data1 !== "number" || (data1 % 1) || data1 !== data1)) {
69
- var dataType1 = typeof data1;
70
- var coerced1 = undefined;
71
- if (coerced1 !== undefined);
72
- else if (dataType1 == 'boolean' || data1 === null || (dataType1 == 'string' && data1 && data1 == +data1 && !(data1 % 1))) coerced1 = +data1;
73
- else {
74
- validate.errors = [{
75
- keyword: 'type',
76
- dataPath: (dataPath || '') + '.keepAliveTimeout',
77
- schemaPath: '#/properties/keepAliveTimeout/type',
78
- params: {
79
- type: 'integer'
80
- },
81
- message: 'should be integer'
82
- }];
83
- return false;
84
- }
85
- if (coerced1 !== undefined) {
86
- data1 = coerced1;
87
- data['keepAliveTimeout'] = coerced1;
88
- }
89
- }
90
- var valid1 = errors === errs_1;
91
- if (valid1) {
92
- var data1 = data.maxRequestsPerSocket;
93
- var errs_1 = errors;
94
- if ((typeof data1 !== "number" || (data1 % 1) || data1 !== data1)) {
95
- var dataType1 = typeof data1;
96
- var coerced1 = undefined;
97
- if (coerced1 !== undefined);
98
- else if (dataType1 == 'boolean' || data1 === null || (dataType1 == 'string' && data1 && data1 == +data1 && !(data1 % 1))) coerced1 = +data1;
99
- else {
100
- validate.errors = [{
101
- keyword: 'type',
102
- dataPath: (dataPath || '') + '.maxRequestsPerSocket',
103
- schemaPath: '#/properties/maxRequestsPerSocket/type',
104
- params: {
105
- type: 'integer'
106
- },
107
- message: 'should be integer'
108
- }];
109
- return false;
110
- }
111
- if (coerced1 !== undefined) {
112
- data1 = coerced1;
113
- data['maxRequestsPerSocket'] = coerced1;
114
- }
115
- }
116
- var valid1 = errors === errs_1;
117
- if (valid1) {
118
- var data1 = data.requestTimeout;
119
- var errs_1 = errors;
120
- if ((typeof data1 !== "number" || (data1 % 1) || data1 !== data1)) {
121
- var dataType1 = typeof data1;
122
- var coerced1 = undefined;
123
- if (coerced1 !== undefined);
124
- else if (dataType1 == 'boolean' || data1 === null || (dataType1 == 'string' && data1 && data1 == +data1 && !(data1 % 1))) coerced1 = +data1;
125
- else {
126
- validate.errors = [{
127
- keyword: 'type',
128
- dataPath: (dataPath || '') + '.requestTimeout',
129
- schemaPath: '#/properties/requestTimeout/type',
130
- params: {
131
- type: 'integer'
132
- },
133
- message: 'should be integer'
134
- }];
135
- return false;
136
- }
137
- if (coerced1 !== undefined) {
138
- data1 = coerced1;
139
- data['requestTimeout'] = coerced1;
140
- }
141
- }
142
- var valid1 = errors === errs_1;
143
- if (valid1) {
144
- var data1 = data.bodyLimit;
145
- var errs_1 = errors;
146
- if ((typeof data1 !== "number" || (data1 % 1) || data1 !== data1)) {
147
- var dataType1 = typeof data1;
148
- var coerced1 = undefined;
149
- if (coerced1 !== undefined);
150
- else if (dataType1 == 'boolean' || data1 === null || (dataType1 == 'string' && data1 && data1 == +data1 && !(data1 % 1))) coerced1 = +data1;
151
- else {
152
- validate.errors = [{
153
- keyword: 'type',
154
- dataPath: (dataPath || '') + '.bodyLimit',
155
- schemaPath: '#/properties/bodyLimit/type',
156
- params: {
157
- type: 'integer'
158
- },
159
- message: 'should be integer'
160
- }];
161
- return false;
162
- }
163
- if (coerced1 !== undefined) {
164
- data1 = coerced1;
165
- data['bodyLimit'] = coerced1;
166
- }
167
- }
168
- var valid1 = errors === errs_1;
169
- if (valid1) {
170
- var data1 = data.caseSensitive;
171
- var errs_1 = errors;
172
- if (typeof data1 !== "boolean") {
173
- var dataType1 = typeof data1;
174
- var coerced1 = undefined;
175
- if (coerced1 !== undefined);
176
- else if (data1 === 'false' || data1 === 0 || data1 === null) coerced1 = false;
177
- else if (data1 === 'true' || data1 === 1) coerced1 = true;
178
- else {
179
- validate.errors = [{
180
- keyword: 'type',
181
- dataPath: (dataPath || '') + '.caseSensitive',
182
- schemaPath: '#/properties/caseSensitive/type',
183
- params: {
184
- type: 'boolean'
185
- },
186
- message: 'should be boolean'
187
- }];
188
- return false;
189
- }
190
- if (coerced1 !== undefined) {
191
- data1 = coerced1;
192
- data['caseSensitive'] = coerced1;
193
- }
194
- }
195
- var valid1 = errors === errs_1;
196
- if (valid1) {
197
- var data1 = data.http2;
198
- if (data1 === undefined) {
199
- valid1 = true;
200
- } else {
201
- var errs_1 = errors;
202
- if (typeof data1 !== "boolean") {
203
- var dataType1 = typeof data1;
204
- var coerced1 = undefined;
205
- if (coerced1 !== undefined);
206
- else if (data1 === 'false' || data1 === 0 || data1 === null) coerced1 = false;
207
- else if (data1 === 'true' || data1 === 1) coerced1 = true;
208
- else {
209
- validate.errors = [{
210
- keyword: 'type',
211
- dataPath: (dataPath || '') + '.http2',
212
- schemaPath: '#/properties/http2/type',
213
- params: {
214
- type: 'boolean'
215
- },
216
- message: 'should be boolean'
217
- }];
218
- return false;
219
- }
220
- if (coerced1 !== undefined) {
221
- data1 = coerced1;
222
- data['http2'] = coerced1;
223
- }
224
- }
225
- var valid1 = errors === errs_1;
226
- }
227
- if (valid1) {
228
- var data1 = data.https;
229
- if (data1 === undefined) {
230
- valid1 = true;
231
- } else {
232
- var errs_1 = errors;
233
- var errs__1 = errors;
234
- var valid1 = true;
235
- var errs_2 = errors;
236
- var errs__2 = errors;
237
- var errs_3 = errors;
238
- var errs__3 = errors,
239
- prevValid3 = false,
240
- valid3 = false,
241
- passingSchemas3 = null;
242
- var errs_4 = errors;
243
- if (typeof data1 !== "boolean") {
244
- var dataType4 = typeof data1;
245
- var coerced4 = undefined;
246
- if (coerced4 !== undefined);
247
- else if (data1 === 'false' || data1 === 0 || data1 === null) coerced4 = false;
248
- else if (data1 === 'true' || data1 === 1) coerced4 = true;
249
- else {
250
- var err = {};
251
- if (vErrors === null) vErrors = [err];
252
- else vErrors.push(err);
253
- errors++;
254
- }
255
- if (coerced4 !== undefined) {
256
- data1 = coerced4;
257
- data['https'] = coerced4;
258
- }
259
- }
260
- var valid4 = errors === errs_4;
261
- if (valid4) {
262
- valid3 = prevValid3 = true;
263
- passingSchemas3 = 0;
264
- }
265
- var errs_4 = errors;
266
- if (data1 !== null) {
267
- var dataType4 = typeof data1;
268
- var coerced4 = undefined;
269
- if (coerced4 !== undefined);
270
- else if (data1 === '' || data1 === 0 || data1 === false) coerced4 = null;
271
- else {
272
- var err = {};
273
- if (vErrors === null) vErrors = [err];
274
- else vErrors.push(err);
275
- errors++;
276
- }
277
- if (coerced4 !== undefined) {
278
- data1 = coerced4;
279
- data['https'] = coerced4;
280
- }
281
- }
282
- var valid4 = errors === errs_4;
283
- if (valid4 && prevValid3) {
284
- valid3 = false;
285
- passingSchemas3 = [passingSchemas3, 1];
286
- } else {
287
- if (valid4) {
288
- valid3 = prevValid3 = true;
289
- passingSchemas3 = 1;
290
- }
291
- var errs_4 = errors;
292
- if ((data1 && typeof data1 === "object" && !Array.isArray(data1))) {
293
- if (true) {
294
- var errs__4 = errors;
295
- var valid5 = true;
296
- for (var key4 in data1) {
297
- var isAdditional4 = !(false || key4 == 'allowHTTP1');
298
- if (isAdditional4) {
299
- delete data1[key4];
300
- }
301
- }
302
- if (valid5) {
303
- var data2 = data1.allowHTTP1;
304
- if (data2 === undefined) {
305
- valid5 = false;
306
- var err = {};
307
- if (vErrors === null) vErrors = [err];
308
- else vErrors.push(err);
309
- errors++;
310
- } else {
311
- var errs_5 = errors;
312
- if (typeof data2 !== "boolean") {
313
- var dataType5 = typeof data2;
314
- var coerced5 = undefined;
315
- if (coerced5 !== undefined);
316
- else if (data2 === 'false' || data2 === 0 || data2 === null) coerced5 = false;
317
- else if (data2 === 'true' || data2 === 1) coerced5 = true;
318
- else {
319
- var err = {};
320
- if (vErrors === null) vErrors = [err];
321
- else vErrors.push(err);
322
- errors++;
323
- }
324
- if (coerced5 !== undefined) {
325
- data2 = coerced5;
326
- data1['allowHTTP1'] = coerced5;
327
- }
328
- }
329
- var valid5 = errors === errs_5;
330
- }
331
- if (valid5) {}
332
- }
333
- if (errs__4 == errors) {}
334
- }
335
- } else {
336
- var err = {};
337
- if (vErrors === null) vErrors = [err];
338
- else vErrors.push(err);
339
- errors++;
340
- }
341
- if (errors === errs_4) {}
342
- var valid4 = errors === errs_4;
343
- if (valid4 && prevValid3) {
344
- valid3 = false;
345
- passingSchemas3 = [passingSchemas3, 2];
346
- } else {
347
- if (valid4) {
348
- valid3 = prevValid3 = true;
349
- passingSchemas3 = 2;
350
- }
351
- }
352
- }
353
- if (!valid3) {
354
- var err = {};
355
- if (vErrors === null) vErrors = [err];
356
- else vErrors.push(err);
357
- errors++;
358
- } else {
359
- errors = errs__3;
360
- if (vErrors !== null) {
361
- if (errs__3) vErrors.length = errs__3;
362
- else vErrors = null;
363
- }
364
- }
365
- if (errors === errs_3) {}
366
- var valid3 = errors === errs_3;
367
- if (valid3) {
368
- var err = {};
369
- if (vErrors === null) vErrors = [err];
370
- else vErrors.push(err);
371
- errors++;
372
- } else {
373
- errors = errs__2;
374
- if (vErrors !== null) {
375
- if (errs__2) vErrors.length = errs__2;
376
- else vErrors = null;
377
- }
378
- }
379
- if (errors === errs_2) {}
380
- var valid2 = errors === errs_2;
381
- errors = errs__1;
382
- if (vErrors !== null) {
383
- if (errs__1) vErrors.length = errs__1;
384
- else vErrors = null;
385
- }
386
- if (valid2) {
387
- var errs_2 = errors;
388
- customRule0.errors = null;
389
- var errs__2 = errors;
390
- var valid2;
391
- valid2 = customRule0.call(self, validate.schema.properties.https.then.setDefaultValue, data1, validate.schema.properties.https.then, (dataPath || '') + '.https', data, 'https', rootData);
392
- if (data) data1 = data['https'];
393
- if (!valid2) {
394
- validate.errors = [{
395
- keyword: 'setDefaultValue',
396
- dataPath: (dataPath || '') + '.https',
397
- schemaPath: '#/properties/https/then/setDefaultValue',
398
- params: {
399
- keyword: 'setDefaultValue'
400
- },
401
- message: 'should pass "setDefaultValue" keyword validation'
402
- }];
403
- return false;
404
- } else {}
405
- if (errors === errs_2) {}
406
- var valid2 = errors === errs_2;
407
- valid1 = valid2;
408
- }
409
- if (!valid1) {
410
- var err = {
411
- keyword: 'if',
412
- dataPath: (dataPath || '') + '.https',
413
- schemaPath: '#/properties/https/if',
414
- params: {
415
- failingKeyword: 'then'
416
- },
417
- message: 'should match "' + 'then' + '" schema'
418
- };
419
- if (vErrors === null) vErrors = [err];
420
- else vErrors.push(err);
421
- errors++;
422
- validate.errors = vErrors;
423
- return false;
424
- } else {}
425
- if (errors === errs_1) {}
426
- var valid1 = errors === errs_1;
427
- }
428
- if (valid1) {
429
- var data1 = data.ignoreTrailingSlash;
430
- var errs_1 = errors;
431
- if (typeof data1 !== "boolean") {
432
- var dataType1 = typeof data1;
433
- var coerced1 = undefined;
434
- if (coerced1 !== undefined);
435
- else if (data1 === 'false' || data1 === 0 || data1 === null) coerced1 = false;
436
- else if (data1 === 'true' || data1 === 1) coerced1 = true;
437
- else {
438
- validate.errors = [{
439
- keyword: 'type',
440
- dataPath: (dataPath || '') + '.ignoreTrailingSlash',
441
- schemaPath: '#/properties/ignoreTrailingSlash/type',
442
- params: {
443
- type: 'boolean'
444
- },
445
- message: 'should be boolean'
446
- }];
447
- return false;
448
- }
449
- if (coerced1 !== undefined) {
450
- data1 = coerced1;
451
- data['ignoreTrailingSlash'] = coerced1;
452
- }
453
- }
454
- var valid1 = errors === errs_1;
455
- if (valid1) {
456
- var data1 = data.disableRequestLogging;
457
- var errs_1 = errors;
458
- if (typeof data1 !== "boolean") {
459
- var dataType1 = typeof data1;
460
- var coerced1 = undefined;
461
- if (coerced1 !== undefined);
462
- else if (data1 === 'false' || data1 === 0 || data1 === null) coerced1 = false;
463
- else if (data1 === 'true' || data1 === 1) coerced1 = true;
464
- else {
465
- validate.errors = [{
466
- keyword: 'type',
467
- dataPath: (dataPath || '') + '.disableRequestLogging',
468
- schemaPath: '#/properties/disableRequestLogging/type',
469
- params: {
470
- type: 'boolean'
471
- },
472
- message: 'should be boolean'
473
- }];
474
- return false;
475
- }
476
- if (coerced1 !== undefined) {
477
- data1 = coerced1;
478
- data['disableRequestLogging'] = coerced1;
479
- }
480
- }
481
- var valid1 = errors === errs_1;
482
- if (valid1) {
483
- var data1 = data.jsonShorthand;
484
- var errs_1 = errors;
485
- if (typeof data1 !== "boolean") {
486
- var dataType1 = typeof data1;
487
- var coerced1 = undefined;
488
- if (coerced1 !== undefined);
489
- else if (data1 === 'false' || data1 === 0 || data1 === null) coerced1 = false;
490
- else if (data1 === 'true' || data1 === 1) coerced1 = true;
491
- else {
492
- validate.errors = [{
493
- keyword: 'type',
494
- dataPath: (dataPath || '') + '.jsonShorthand',
495
- schemaPath: '#/properties/jsonShorthand/type',
496
- params: {
497
- type: 'boolean'
498
- },
499
- message: 'should be boolean'
500
- }];
501
- return false;
502
- }
503
- if (coerced1 !== undefined) {
504
- data1 = coerced1;
505
- data['jsonShorthand'] = coerced1;
506
- }
507
- }
508
- var valid1 = errors === errs_1;
509
- if (valid1) {
510
- var data1 = data.maxParamLength;
511
- var errs_1 = errors;
512
- if ((typeof data1 !== "number" || (data1 % 1) || data1 !== data1)) {
513
- var dataType1 = typeof data1;
514
- var coerced1 = undefined;
515
- if (coerced1 !== undefined);
516
- else if (dataType1 == 'boolean' || data1 === null || (dataType1 == 'string' && data1 && data1 == +data1 && !(data1 % 1))) coerced1 = +data1;
517
- else {
518
- validate.errors = [{
519
- keyword: 'type',
520
- dataPath: (dataPath || '') + '.maxParamLength',
521
- schemaPath: '#/properties/maxParamLength/type',
522
- params: {
523
- type: 'integer'
524
- },
525
- message: 'should be integer'
526
- }];
527
- return false;
528
- }
529
- if (coerced1 !== undefined) {
530
- data1 = coerced1;
531
- data['maxParamLength'] = coerced1;
532
- }
533
- }
534
- var valid1 = errors === errs_1;
535
- if (valid1) {
536
- var data1 = data.onProtoPoisoning;
537
- var errs_1 = errors;
538
- if (typeof data1 !== "string") {
539
- var dataType1 = typeof data1;
540
- var coerced1 = undefined;
541
- if (coerced1 !== undefined);
542
- else if (dataType1 == 'number' || dataType1 == 'boolean') coerced1 = '' + data1;
543
- else if (data1 === null) coerced1 = '';
544
- else {
545
- validate.errors = [{
546
- keyword: 'type',
547
- dataPath: (dataPath || '') + '.onProtoPoisoning',
548
- schemaPath: '#/properties/onProtoPoisoning/type',
549
- params: {
550
- type: 'string'
551
- },
552
- message: 'should be string'
553
- }];
554
- return false;
555
- }
556
- if (coerced1 !== undefined) {
557
- data1 = coerced1;
558
- data['onProtoPoisoning'] = coerced1;
559
- }
560
- }
561
- var valid1 = errors === errs_1;
562
- if (valid1) {
563
- var data1 = data.onConstructorPoisoning;
564
- var errs_1 = errors;
565
- if (typeof data1 !== "string") {
566
- var dataType1 = typeof data1;
567
- var coerced1 = undefined;
568
- if (coerced1 !== undefined);
569
- else if (dataType1 == 'number' || dataType1 == 'boolean') coerced1 = '' + data1;
570
- else if (data1 === null) coerced1 = '';
571
- else {
572
- validate.errors = [{
573
- keyword: 'type',
574
- dataPath: (dataPath || '') + '.onConstructorPoisoning',
575
- schemaPath: '#/properties/onConstructorPoisoning/type',
576
- params: {
577
- type: 'string'
578
- },
579
- message: 'should be string'
580
- }];
581
- return false;
582
- }
583
- if (coerced1 !== undefined) {
584
- data1 = coerced1;
585
- data['onConstructorPoisoning'] = coerced1;
586
- }
587
- }
588
- var valid1 = errors === errs_1;
589
- if (valid1) {
590
- var data1 = data.pluginTimeout;
591
- var errs_1 = errors;
592
- if ((typeof data1 !== "number" || (data1 % 1) || data1 !== data1)) {
593
- var dataType1 = typeof data1;
594
- var coerced1 = undefined;
595
- if (coerced1 !== undefined);
596
- else if (dataType1 == 'boolean' || data1 === null || (dataType1 == 'string' && data1 && data1 == +data1 && !(data1 % 1))) coerced1 = +data1;
597
- else {
598
- validate.errors = [{
599
- keyword: 'type',
600
- dataPath: (dataPath || '') + '.pluginTimeout',
601
- schemaPath: '#/properties/pluginTimeout/type',
602
- params: {
603
- type: 'integer'
604
- },
605
- message: 'should be integer'
606
- }];
607
- return false;
608
- }
609
- if (coerced1 !== undefined) {
610
- data1 = coerced1;
611
- data['pluginTimeout'] = coerced1;
612
- }
613
- }
614
- var valid1 = errors === errs_1;
615
- if (valid1) {
616
- var data1 = data.requestIdHeader;
617
- var errs_1 = errors;
618
- if (typeof data1 !== "string") {
619
- var dataType1 = typeof data1;
620
- var coerced1 = undefined;
621
- if (coerced1 !== undefined);
622
- else if (dataType1 == 'number' || dataType1 == 'boolean') coerced1 = '' + data1;
623
- else if (data1 === null) coerced1 = '';
624
- else {
625
- validate.errors = [{
626
- keyword: 'type',
627
- dataPath: (dataPath || '') + '.requestIdHeader',
628
- schemaPath: '#/properties/requestIdHeader/type',
629
- params: {
630
- type: 'string'
631
- },
632
- message: 'should be string'
633
- }];
634
- return false;
635
- }
636
- if (coerced1 !== undefined) {
637
- data1 = coerced1;
638
- data['requestIdHeader'] = coerced1;
639
- }
640
- }
641
- var valid1 = errors === errs_1;
642
- if (valid1) {
643
- var data1 = data.requestIdLogLabel;
644
- var errs_1 = errors;
645
- if (typeof data1 !== "string") {
646
- var dataType1 = typeof data1;
647
- var coerced1 = undefined;
648
- if (coerced1 !== undefined);
649
- else if (dataType1 == 'number' || dataType1 == 'boolean') coerced1 = '' + data1;
650
- else if (data1 === null) coerced1 = '';
651
- else {
652
- validate.errors = [{
653
- keyword: 'type',
654
- dataPath: (dataPath || '') + '.requestIdLogLabel',
655
- schemaPath: '#/properties/requestIdLogLabel/type',
656
- params: {
657
- type: 'string'
658
- },
659
- message: 'should be string'
660
- }];
661
- return false;
662
- }
663
- if (coerced1 !== undefined) {
664
- data1 = coerced1;
665
- data['requestIdLogLabel'] = coerced1;
666
- }
667
- }
668
- var valid1 = errors === errs_1;
669
- if (valid1) {
670
- var data1 = data.http2SessionTimeout;
671
- var errs_1 = errors;
672
- if ((typeof data1 !== "number" || (data1 % 1) || data1 !== data1)) {
673
- var dataType1 = typeof data1;
674
- var coerced1 = undefined;
675
- if (coerced1 !== undefined);
676
- else if (dataType1 == 'boolean' || data1 === null || (dataType1 == 'string' && data1 && data1 == +data1 && !(data1 % 1))) coerced1 = +data1;
677
- else {
678
- validate.errors = [{
679
- keyword: 'type',
680
- dataPath: (dataPath || '') + '.http2SessionTimeout',
681
- schemaPath: '#/properties/http2SessionTimeout/type',
682
- params: {
683
- type: 'integer'
684
- },
685
- message: 'should be integer'
686
- }];
687
- return false;
688
- }
689
- if (coerced1 !== undefined) {
690
- data1 = coerced1;
691
- data['http2SessionTimeout'] = coerced1;
692
- }
693
- }
694
- var valid1 = errors === errs_1;
695
- if (valid1) {
696
- var data1 = data.versioning;
697
- if (data1 === undefined) {
698
- valid1 = true;
699
- } else {
700
- var errs_1 = errors;
701
- if ((data1 && typeof data1 === "object" && !Array.isArray(data1))) {
702
- var missing1;
703
- if (((data1.storage === undefined) && (missing1 = '.storage')) || ((data1.deriveVersion === undefined) && (missing1 = '.deriveVersion'))) {
704
- validate.errors = [{
705
- keyword: 'required',
706
- dataPath: (dataPath || '') + '.versioning',
707
- schemaPath: '#/properties/versioning/required',
708
- params: {
709
- missingProperty: '' + missing1 + ''
710
- },
711
- message: 'should have required property \'' + missing1 + '\''
712
- }];
713
- return false;
714
- } else {
715
- var errs__1 = errors;
716
- var valid2 = true;
717
- for (var key1 in data1) {
718
- var isAdditional1 = !(false || key1 == 'storage' || key1 == 'deriveVersion');
719
- if (isAdditional1) {}
720
- }
721
- if (valid2) {
722
- if (valid2) {
723
- if (valid2) {}
724
- }
725
- }
726
- if (errs__1 == errors) {}
727
- }
728
- } else {
729
- validate.errors = [{
730
- keyword: 'type',
731
- dataPath: (dataPath || '') + '.versioning',
732
- schemaPath: '#/properties/versioning/type',
733
- params: {
734
- type: 'object'
735
- },
736
- message: 'should be object'
737
- }];
738
- return false;
739
- }
740
- if (errors === errs_1) {}
741
- var valid1 = errors === errs_1;
742
- }
743
- if (valid1) {
744
- var data1 = data.constraints;
745
- if (data1 === undefined) {
746
- valid1 = true;
747
- } else {
748
- var errs_1 = errors;
749
- if ((data1 && typeof data1 === "object" && !Array.isArray(data1))) {
750
- var errs__1 = errors;
751
- var valid2 = true;
752
- for (var key1 in data1) {
753
- var data2 = data1[key1];
754
- var errs_2 = errors;
755
- if ((data2 && typeof data2 === "object" && !Array.isArray(data2))) {
756
- var missing2;
757
- if (((data2.storage === undefined) && (missing2 = '.storage')) || ((data2.validate === undefined) && (missing2 = '.validate')) || ((data2.deriveConstraint === undefined) && (missing2 = '.deriveConstraint'))) {
758
- validate.errors = [{
759
- keyword: 'required',
760
- dataPath: (dataPath || '') + '.constraints[\'' + key1 + '\']',
761
- schemaPath: '#/properties/constraints/additionalProperties/required',
762
- params: {
763
- missingProperty: '' + missing2 + ''
764
- },
765
- message: 'should have required property \'' + missing2 + '\''
766
- }];
767
- return false;
768
- } else {
769
- var errs__2 = errors;
770
- var valid3 = true;
771
- for (var key2 in data2) {
772
- var isAdditional2 = !(false || key2 == 'name' || key2 == 'storage' || key2 == 'validate' || key2 == 'deriveConstraint');
773
- if (isAdditional2) {}
774
- }
775
- if (valid3) {
776
- var data3 = data2.name;
777
- if (data3 === undefined) {
778
- valid3 = false;
779
- validate.errors = [{
780
- keyword: 'required',
781
- dataPath: (dataPath || '') + '.constraints[\'' + key1 + '\']',
782
- schemaPath: '#/properties/constraints/additionalProperties/required',
783
- params: {
784
- missingProperty: 'name'
785
- },
786
- message: 'should have required property \'name\''
787
- }];
788
- return false;
789
- } else {
790
- var errs_3 = errors;
791
- if (typeof data3 !== "string") {
792
- var dataType3 = typeof data3;
793
- var coerced3 = undefined;
794
- if (coerced3 !== undefined);
795
- else if (dataType3 == 'number' || dataType3 == 'boolean') coerced3 = '' + data3;
796
- else if (data3 === null) coerced3 = '';
797
- else {
798
- validate.errors = [{
799
- keyword: 'type',
800
- dataPath: (dataPath || '') + '.constraints[\'' + key1 + '\'].name',
801
- schemaPath: '#/properties/constraints/additionalProperties/properties/name/type',
802
- params: {
803
- type: 'string'
804
- },
805
- message: 'should be string'
806
- }];
807
- return false;
808
- }
809
- if (coerced3 !== undefined) {
810
- data3 = coerced3;
811
- data2['name'] = coerced3;
812
- }
813
- }
814
- var valid3 = errors === errs_3;
815
- }
816
- if (valid3) {
817
- if (valid3) {
818
- if (valid3) {
819
- if (valid3) {}
820
- }
821
- }
822
- }
823
- }
824
- if (errs__2 == errors) {}
825
- }
826
- } else {
827
- validate.errors = [{
828
- keyword: 'type',
829
- dataPath: (dataPath || '') + '.constraints[\'' + key1 + '\']',
830
- schemaPath: '#/properties/constraints/additionalProperties/type',
831
- params: {
832
- type: 'object'
833
- },
834
- message: 'should be object'
835
- }];
836
- return false;
837
- }
838
- if (errors === errs_2) {}
839
- var valid2 = errors === errs_2;
840
- if (!valid2) break;
841
- }
842
- if (valid2) {}
843
- if (errs__1 == errors) {}
844
- } else {
845
- validate.errors = [{
846
- keyword: 'type',
847
- dataPath: (dataPath || '') + '.constraints',
848
- schemaPath: '#/properties/constraints/type',
849
- params: {
850
- type: 'object'
851
- },
852
- message: 'should be object'
853
- }];
854
- return false;
855
- }
856
- if (errors === errs_1) {}
857
- var valid1 = errors === errs_1;
858
- }
859
- if (valid1) {}
860
- }
861
- }
862
- }
863
- }
864
- }
865
- }
866
- }
867
- }
868
- }
869
- }
870
- }
871
- }
872
- }
873
- }
874
- }
875
- }
876
- }
877
- }
878
- }
879
- }
880
- if (errs__0 == errors) {}
881
- } else {
882
- validate.errors = [{
883
- keyword: 'type',
884
- dataPath: (dataPath || '') + "",
885
- schemaPath: '#/type',
886
- params: {
887
- type: 'object'
888
- },
889
- message: 'should be object'
890
- }];
891
- return false;
892
- }
893
- if (errors === 0) {}
894
- validate.errors = vErrors;
895
- return errors === 0;
896
- };
897
- })();
898
- validate.schema = {
899
- "type": "object",
900
- "additionalProperties": false,
901
- "properties": {
902
- "connectionTimeout": {
903
- "type": "integer",
904
- "default": 0
905
- },
906
- "keepAliveTimeout": {
907
- "type": "integer",
908
- "default": 5000
909
- },
910
- "maxRequestsPerSocket": {
911
- "type": "integer",
912
- "default": 0,
913
- "nullable": true
914
- },
915
- "requestTimeout": {
916
- "type": "integer",
917
- "default": 0
918
- },
919
- "bodyLimit": {
920
- "type": "integer",
921
- "default": 1048576
922
- },
923
- "caseSensitive": {
924
- "type": "boolean",
925
- "default": true
926
- },
927
- "http2": {
928
- "type": "boolean"
929
- },
930
- "https": {
931
- "if": {
932
- "not": {
933
- "oneOf": [{
934
- "type": "boolean"
935
- }, {
936
- "type": "null"
937
- }, {
938
- "type": "object",
939
- "additionalProperties": false,
940
- "required": ["allowHTTP1"],
941
- "properties": {
942
- "allowHTTP1": {
943
- "type": "boolean"
944
- }
945
- }
946
- }]
947
- }
948
- },
949
- "then": {
950
- "setDefaultValue": true
951
- }
952
- },
953
- "ignoreTrailingSlash": {
954
- "type": "boolean",
955
- "default": false
956
- },
957
- "disableRequestLogging": {
958
- "type": "boolean",
959
- "default": false
960
- },
961
- "jsonShorthand": {
962
- "type": "boolean",
963
- "default": true
964
- },
965
- "maxParamLength": {
966
- "type": "integer",
967
- "default": 100
968
- },
969
- "onProtoPoisoning": {
970
- "type": "string",
971
- "default": "error"
972
- },
973
- "onConstructorPoisoning": {
974
- "type": "string",
975
- "default": "error"
976
- },
977
- "pluginTimeout": {
978
- "type": "integer",
979
- "default": 10000
980
- },
981
- "requestIdHeader": {
982
- "type": "string",
983
- "default": "request-id"
984
- },
985
- "requestIdLogLabel": {
986
- "type": "string",
987
- "default": "reqId"
988
- },
989
- "http2SessionTimeout": {
990
- "type": "integer",
991
- "default": 5000
992
- },
993
- "versioning": {
994
- "type": "object",
995
- "additionalProperties": true,
996
- "required": ["storage", "deriveVersion"],
997
- "properties": {
998
- "storage": {},
999
- "deriveVersion": {}
1000
- }
1001
- },
1002
- "constraints": {
1003
- "type": "object",
1004
- "additionalProperties": {
1005
- "type": "object",
1006
- "required": ["name", "storage", "validate", "deriveConstraint"],
1007
- "additionalProperties": true,
1008
- "properties": {
1009
- "name": {
1010
- "type": "string"
1011
- },
1012
- "storage": {},
1013
- "validate": {},
1014
- "deriveConstraint": {}
1015
- }
1016
- }
1017
- }
1018
- }
1019
- };
1020
- validate.errors = null;
1021
- module.exports = validate;
1022
-
1023
- function customRule0 (schemaParamValue, validatedParamValue, validationSchemaObject, currentDataPath, validatedParamObject, validatedParam) {
1024
- validatedParamObject[validatedParam] = schemaParamValue
1025
- return true
9
+ function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){
10
+ let vErrors = null;
11
+ let errors = 0;
12
+ if(errors === 0){
13
+ if(data && typeof data == "object" && !Array.isArray(data)){
14
+ if(data.connectionTimeout === undefined){
15
+ data.connectionTimeout = 0;
16
+ }
17
+ if(data.keepAliveTimeout === undefined){
18
+ data.keepAliveTimeout = 72000;
19
+ }
20
+ if(data.forceCloseConnections === undefined){
21
+ data.forceCloseConnections = false;
22
+ }
23
+ if(data.maxRequestsPerSocket === undefined){
24
+ data.maxRequestsPerSocket = 0;
25
+ }
26
+ if(data.requestTimeout === undefined){
27
+ data.requestTimeout = 0;
28
+ }
29
+ if(data.bodyLimit === undefined){
30
+ data.bodyLimit = 1048576;
31
+ }
32
+ if(data.caseSensitive === undefined){
33
+ data.caseSensitive = true;
34
+ }
35
+ if(data.ignoreTrailingSlash === undefined){
36
+ data.ignoreTrailingSlash = false;
37
+ }
38
+ if(data.disableRequestLogging === undefined){
39
+ data.disableRequestLogging = false;
40
+ }
41
+ if(data.jsonShorthand === undefined){
42
+ data.jsonShorthand = true;
43
+ }
44
+ if(data.maxParamLength === undefined){
45
+ data.maxParamLength = 100;
46
+ }
47
+ if(data.onProtoPoisoning === undefined){
48
+ data.onProtoPoisoning = "error";
49
+ }
50
+ if(data.onConstructorPoisoning === undefined){
51
+ data.onConstructorPoisoning = "error";
52
+ }
53
+ if(data.pluginTimeout === undefined){
54
+ data.pluginTimeout = 10000;
55
+ }
56
+ if(data.requestIdHeader === undefined){
57
+ data.requestIdHeader = "request-id";
58
+ }
59
+ if(data.requestIdLogLabel === undefined){
60
+ data.requestIdLogLabel = "reqId";
61
+ }
62
+ if(data.http2SessionTimeout === undefined){
63
+ data.http2SessionTimeout = 72000;
64
+ }
65
+ if(data.exposeHeadRoutes === undefined){
66
+ data.exposeHeadRoutes = true;
67
+ }
68
+ const _errs1 = errors;
69
+ for(const key0 in data){
70
+ if(!(func4.call(schema11.properties, key0))){
71
+ delete data[key0];
72
+ }
73
+ }
74
+ if(_errs1 === errors){
75
+ let data0 = data.connectionTimeout;
76
+ const _errs2 = errors;
77
+ if(!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))){
78
+ let dataType0 = typeof data0;
79
+ let coerced0 = undefined;
80
+ if(!(coerced0 !== undefined)){
81
+ if(dataType0 === "boolean" || data0 === null
82
+ || (dataType0 === "string" && data0 && data0 == +data0 && !(data0 % 1))){
83
+ coerced0 = +data0;
84
+ }
85
+ else {
86
+ validate10.errors = [{instancePath:instancePath+"/connectionTimeout",schemaPath:"#/properties/connectionTimeout/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
87
+ return false;
88
+ }
89
+ }
90
+ if(coerced0 !== undefined){
91
+ data0 = coerced0;
92
+ if(data !== undefined){
93
+ data["connectionTimeout"] = coerced0;
94
+ }
95
+ }
96
+ }
97
+ var valid0 = _errs2 === errors;
98
+ if(valid0){
99
+ let data1 = data.keepAliveTimeout;
100
+ const _errs4 = errors;
101
+ if(!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))){
102
+ let dataType1 = typeof data1;
103
+ let coerced1 = undefined;
104
+ if(!(coerced1 !== undefined)){
105
+ if(dataType1 === "boolean" || data1 === null
106
+ || (dataType1 === "string" && data1 && data1 == +data1 && !(data1 % 1))){
107
+ coerced1 = +data1;
108
+ }
109
+ else {
110
+ validate10.errors = [{instancePath:instancePath+"/keepAliveTimeout",schemaPath:"#/properties/keepAliveTimeout/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
111
+ return false;
112
+ }
113
+ }
114
+ if(coerced1 !== undefined){
115
+ data1 = coerced1;
116
+ if(data !== undefined){
117
+ data["keepAliveTimeout"] = coerced1;
118
+ }
119
+ }
120
+ }
121
+ var valid0 = _errs4 === errors;
122
+ if(valid0){
123
+ let data2 = data.forceCloseConnections;
124
+ const _errs6 = errors;
125
+ if(typeof data2 !== "boolean"){
126
+ let coerced2 = undefined;
127
+ if(!(coerced2 !== undefined)){
128
+ if(data2 === "false" || data2 === 0 || data2 === null){
129
+ coerced2 = false;
130
+ }
131
+ else if(data2 === "true" || data2 === 1){
132
+ coerced2 = true;
133
+ }
134
+ else {
135
+ validate10.errors = [{instancePath:instancePath+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
136
+ return false;
137
+ }
138
+ }
139
+ if(coerced2 !== undefined){
140
+ data2 = coerced2;
141
+ if(data !== undefined){
142
+ data["forceCloseConnections"] = coerced2;
143
+ }
144
+ }
145
+ }
146
+ var valid0 = _errs6 === errors;
147
+ if(valid0){
148
+ let data3 = data.maxRequestsPerSocket;
149
+ const _errs8 = errors;
150
+ if((!(((typeof data3 == "number") && (!(data3 % 1) && !isNaN(data3))) && (isFinite(data3)))) && (data3 !== null)){
151
+ let dataType3 = typeof data3;
152
+ let coerced3 = undefined;
153
+ if(!(coerced3 !== undefined)){
154
+ if(dataType3 === "boolean" || data3 === null
155
+ || (dataType3 === "string" && data3 && data3 == +data3 && !(data3 % 1))){
156
+ coerced3 = +data3;
157
+ }
158
+ else if(data3 === "" || data3 === 0 || data3 === false){
159
+ coerced3 = null;
160
+ }
161
+ else {
162
+ validate10.errors = [{instancePath:instancePath+"/maxRequestsPerSocket",schemaPath:"#/properties/maxRequestsPerSocket/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
163
+ return false;
164
+ }
165
+ }
166
+ if(coerced3 !== undefined){
167
+ data3 = coerced3;
168
+ if(data !== undefined){
169
+ data["maxRequestsPerSocket"] = coerced3;
170
+ }
171
+ }
172
+ }
173
+ var valid0 = _errs8 === errors;
174
+ if(valid0){
175
+ let data4 = data.requestTimeout;
176
+ const _errs11 = errors;
177
+ if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){
178
+ let dataType4 = typeof data4;
179
+ let coerced4 = undefined;
180
+ if(!(coerced4 !== undefined)){
181
+ if(dataType4 === "boolean" || data4 === null
182
+ || (dataType4 === "string" && data4 && data4 == +data4 && !(data4 % 1))){
183
+ coerced4 = +data4;
184
+ }
185
+ else {
186
+ validate10.errors = [{instancePath:instancePath+"/requestTimeout",schemaPath:"#/properties/requestTimeout/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
187
+ return false;
188
+ }
189
+ }
190
+ if(coerced4 !== undefined){
191
+ data4 = coerced4;
192
+ if(data !== undefined){
193
+ data["requestTimeout"] = coerced4;
194
+ }
195
+ }
196
+ }
197
+ var valid0 = _errs11 === errors;
198
+ if(valid0){
199
+ let data5 = data.bodyLimit;
200
+ const _errs13 = errors;
201
+ if(!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))){
202
+ let dataType5 = typeof data5;
203
+ let coerced5 = undefined;
204
+ if(!(coerced5 !== undefined)){
205
+ if(dataType5 === "boolean" || data5 === null
206
+ || (dataType5 === "string" && data5 && data5 == +data5 && !(data5 % 1))){
207
+ coerced5 = +data5;
208
+ }
209
+ else {
210
+ validate10.errors = [{instancePath:instancePath+"/bodyLimit",schemaPath:"#/properties/bodyLimit/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
211
+ return false;
212
+ }
213
+ }
214
+ if(coerced5 !== undefined){
215
+ data5 = coerced5;
216
+ if(data !== undefined){
217
+ data["bodyLimit"] = coerced5;
218
+ }
219
+ }
220
+ }
221
+ var valid0 = _errs13 === errors;
222
+ if(valid0){
223
+ let data6 = data.caseSensitive;
224
+ const _errs15 = errors;
225
+ if(typeof data6 !== "boolean"){
226
+ let coerced6 = undefined;
227
+ if(!(coerced6 !== undefined)){
228
+ if(data6 === "false" || data6 === 0 || data6 === null){
229
+ coerced6 = false;
230
+ }
231
+ else if(data6 === "true" || data6 === 1){
232
+ coerced6 = true;
233
+ }
234
+ else {
235
+ validate10.errors = [{instancePath:instancePath+"/caseSensitive",schemaPath:"#/properties/caseSensitive/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
236
+ return false;
237
+ }
238
+ }
239
+ if(coerced6 !== undefined){
240
+ data6 = coerced6;
241
+ if(data !== undefined){
242
+ data["caseSensitive"] = coerced6;
243
+ }
244
+ }
245
+ }
246
+ var valid0 = _errs15 === errors;
247
+ if(valid0){
248
+ if(data.http2 !== undefined){
249
+ let data7 = data.http2;
250
+ const _errs17 = errors;
251
+ if(typeof data7 !== "boolean"){
252
+ let coerced7 = undefined;
253
+ if(!(coerced7 !== undefined)){
254
+ if(data7 === "false" || data7 === 0 || data7 === null){
255
+ coerced7 = false;
256
+ }
257
+ else if(data7 === "true" || data7 === 1){
258
+ coerced7 = true;
259
+ }
260
+ else {
261
+ validate10.errors = [{instancePath:instancePath+"/http2",schemaPath:"#/properties/http2/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
262
+ return false;
263
+ }
264
+ }
265
+ if(coerced7 !== undefined){
266
+ data7 = coerced7;
267
+ if(data !== undefined){
268
+ data["http2"] = coerced7;
269
+ }
270
+ }
271
+ }
272
+ var valid0 = _errs17 === errors;
273
+ }
274
+ else {
275
+ var valid0 = true;
276
+ }
277
+ if(valid0){
278
+ if(data.https !== undefined){
279
+ let data8 = data.https;
280
+ const _errs19 = errors;
281
+ const _errs20 = errors;
282
+ let valid1 = true;
283
+ const _errs21 = errors;
284
+ const _errs22 = errors;
285
+ const _errs23 = errors;
286
+ const _errs24 = errors;
287
+ let valid3 = false;
288
+ let passing0 = null;
289
+ const _errs25 = errors;
290
+ if(typeof data8 !== "boolean"){
291
+ let coerced8 = undefined;
292
+ if(!(coerced8 !== undefined)){
293
+ if(data8 === "false" || data8 === 0 || data8 === null){
294
+ coerced8 = false;
295
+ }
296
+ else if(data8 === "true" || data8 === 1){
297
+ coerced8 = true;
298
+ }
299
+ else {
300
+ const err0 = {};
301
+ if(vErrors === null){
302
+ vErrors = [err0];
303
+ }
304
+ else {
305
+ vErrors.push(err0);
306
+ }
307
+ errors++;
308
+ }
309
+ }
310
+ if(coerced8 !== undefined){
311
+ data8 = coerced8;
312
+ if(data !== undefined){
313
+ data["https"] = coerced8;
314
+ }
315
+ }
316
+ }
317
+ var _valid1 = _errs25 === errors;
318
+ if(_valid1){
319
+ valid3 = true;
320
+ passing0 = 0;
321
+ }
322
+ const _errs27 = errors;
323
+ if(data8 !== null){
324
+ let coerced9 = undefined;
325
+ if(!(coerced9 !== undefined)){
326
+ if(data8 === "" || data8 === 0 || data8 === false){
327
+ coerced9 = null;
328
+ }
329
+ else {
330
+ const err1 = {};
331
+ if(vErrors === null){
332
+ vErrors = [err1];
333
+ }
334
+ else {
335
+ vErrors.push(err1);
336
+ }
337
+ errors++;
338
+ }
339
+ }
340
+ if(coerced9 !== undefined){
341
+ data8 = coerced9;
342
+ if(data !== undefined){
343
+ data["https"] = coerced9;
344
+ }
345
+ }
346
+ }
347
+ var _valid1 = _errs27 === errors;
348
+ if(_valid1 && valid3){
349
+ valid3 = false;
350
+ passing0 = [passing0, 1];
351
+ }
352
+ else {
353
+ if(_valid1){
354
+ valid3 = true;
355
+ passing0 = 1;
356
+ }
357
+ const _errs29 = errors;
358
+ if(errors === _errs29){
359
+ if(data8 && typeof data8 == "object" && !Array.isArray(data8)){
360
+ let missing0;
361
+ if((data8.allowHTTP1 === undefined) && (missing0 = "allowHTTP1")){
362
+ const err2 = {};
363
+ if(vErrors === null){
364
+ vErrors = [err2];
365
+ }
366
+ else {
367
+ vErrors.push(err2);
368
+ }
369
+ errors++;
370
+ }
371
+ else {
372
+ const _errs31 = errors;
373
+ for(const key1 in data8){
374
+ if(!(key1 === "allowHTTP1")){
375
+ delete data8[key1];
376
+ }
377
+ }
378
+ if(_errs31 === errors){
379
+ if(data8.allowHTTP1 !== undefined){
380
+ let data9 = data8.allowHTTP1;
381
+ if(typeof data9 !== "boolean"){
382
+ let coerced10 = undefined;
383
+ if(!(coerced10 !== undefined)){
384
+ if(data9 === "false" || data9 === 0 || data9 === null){
385
+ coerced10 = false;
386
+ }
387
+ else if(data9 === "true" || data9 === 1){
388
+ coerced10 = true;
389
+ }
390
+ else {
391
+ const err3 = {};
392
+ if(vErrors === null){
393
+ vErrors = [err3];
394
+ }
395
+ else {
396
+ vErrors.push(err3);
397
+ }
398
+ errors++;
399
+ }
400
+ }
401
+ if(coerced10 !== undefined){
402
+ data9 = coerced10;
403
+ if(data8 !== undefined){
404
+ data8["allowHTTP1"] = coerced10;
405
+ }
406
+ }
407
+ }
408
+ }
409
+ }
410
+ }
411
+ }
412
+ else {
413
+ const err4 = {};
414
+ if(vErrors === null){
415
+ vErrors = [err4];
416
+ }
417
+ else {
418
+ vErrors.push(err4);
419
+ }
420
+ errors++;
421
+ }
422
+ }
423
+ var _valid1 = _errs29 === errors;
424
+ if(_valid1 && valid3){
425
+ valid3 = false;
426
+ passing0 = [passing0, 2];
427
+ }
428
+ else {
429
+ if(_valid1){
430
+ valid3 = true;
431
+ passing0 = 2;
432
+ }
433
+ }
434
+ }
435
+ if(!valid3){
436
+ const err5 = {};
437
+ if(vErrors === null){
438
+ vErrors = [err5];
439
+ }
440
+ else {
441
+ vErrors.push(err5);
442
+ }
443
+ errors++;
444
+ }
445
+ else {
446
+ errors = _errs24;
447
+ if(vErrors !== null){
448
+ if(_errs24){
449
+ vErrors.length = _errs24;
450
+ }
451
+ else {
452
+ vErrors = null;
453
+ }
454
+ }
455
+ }
456
+ var valid2 = _errs23 === errors;
457
+ if(valid2){
458
+ const err6 = {};
459
+ if(vErrors === null){
460
+ vErrors = [err6];
461
+ }
462
+ else {
463
+ vErrors.push(err6);
464
+ }
465
+ errors++;
466
+ }
467
+ else {
468
+ errors = _errs22;
469
+ if(vErrors !== null){
470
+ if(_errs22){
471
+ vErrors.length = _errs22;
472
+ }
473
+ else {
474
+ vErrors = null;
475
+ }
476
+ }
477
+ }
478
+ var _valid0 = _errs21 === errors;
479
+ errors = _errs20;
480
+ if(vErrors !== null){
481
+ if(_errs20){
482
+ vErrors.length = _errs20;
1026
483
  }
484
+ else {
485
+ vErrors = null;
486
+ }
487
+ }
488
+ if(_valid0){
489
+ const _errs34 = errors;
490
+ data["https"] = true;
491
+ var _valid0 = _errs34 === errors;
492
+ valid1 = _valid0;
493
+ }
494
+ if(!valid1){
495
+ const err7 = {instancePath:instancePath+"/https",schemaPath:"#/properties/https/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};
496
+ if(vErrors === null){
497
+ vErrors = [err7];
498
+ }
499
+ else {
500
+ vErrors.push(err7);
501
+ }
502
+ errors++;
503
+ validate10.errors = vErrors;
504
+ return false;
505
+ }
506
+ var valid0 = _errs19 === errors;
507
+ }
508
+ else {
509
+ var valid0 = true;
510
+ }
511
+ if(valid0){
512
+ let data10 = data.ignoreTrailingSlash;
513
+ const _errs35 = errors;
514
+ if(typeof data10 !== "boolean"){
515
+ let coerced11 = undefined;
516
+ if(!(coerced11 !== undefined)){
517
+ if(data10 === "false" || data10 === 0 || data10 === null){
518
+ coerced11 = false;
519
+ }
520
+ else if(data10 === "true" || data10 === 1){
521
+ coerced11 = true;
522
+ }
523
+ else {
524
+ validate10.errors = [{instancePath:instancePath+"/ignoreTrailingSlash",schemaPath:"#/properties/ignoreTrailingSlash/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
525
+ return false;
526
+ }
527
+ }
528
+ if(coerced11 !== undefined){
529
+ data10 = coerced11;
530
+ if(data !== undefined){
531
+ data["ignoreTrailingSlash"] = coerced11;
532
+ }
533
+ }
534
+ }
535
+ var valid0 = _errs35 === errors;
536
+ if(valid0){
537
+ let data11 = data.disableRequestLogging;
538
+ const _errs37 = errors;
539
+ if(typeof data11 !== "boolean"){
540
+ let coerced12 = undefined;
541
+ if(!(coerced12 !== undefined)){
542
+ if(data11 === "false" || data11 === 0 || data11 === null){
543
+ coerced12 = false;
544
+ }
545
+ else if(data11 === "true" || data11 === 1){
546
+ coerced12 = true;
547
+ }
548
+ else {
549
+ validate10.errors = [{instancePath:instancePath+"/disableRequestLogging",schemaPath:"#/properties/disableRequestLogging/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
550
+ return false;
551
+ }
552
+ }
553
+ if(coerced12 !== undefined){
554
+ data11 = coerced12;
555
+ if(data !== undefined){
556
+ data["disableRequestLogging"] = coerced12;
557
+ }
558
+ }
559
+ }
560
+ var valid0 = _errs37 === errors;
561
+ if(valid0){
562
+ let data12 = data.jsonShorthand;
563
+ const _errs39 = errors;
564
+ if(typeof data12 !== "boolean"){
565
+ let coerced13 = undefined;
566
+ if(!(coerced13 !== undefined)){
567
+ if(data12 === "false" || data12 === 0 || data12 === null){
568
+ coerced13 = false;
569
+ }
570
+ else if(data12 === "true" || data12 === 1){
571
+ coerced13 = true;
572
+ }
573
+ else {
574
+ validate10.errors = [{instancePath:instancePath+"/jsonShorthand",schemaPath:"#/properties/jsonShorthand/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
575
+ return false;
576
+ }
577
+ }
578
+ if(coerced13 !== undefined){
579
+ data12 = coerced13;
580
+ if(data !== undefined){
581
+ data["jsonShorthand"] = coerced13;
582
+ }
583
+ }
584
+ }
585
+ var valid0 = _errs39 === errors;
586
+ if(valid0){
587
+ let data13 = data.maxParamLength;
588
+ const _errs41 = errors;
589
+ if(!(((typeof data13 == "number") && (!(data13 % 1) && !isNaN(data13))) && (isFinite(data13)))){
590
+ let dataType14 = typeof data13;
591
+ let coerced14 = undefined;
592
+ if(!(coerced14 !== undefined)){
593
+ if(dataType14 === "boolean" || data13 === null
594
+ || (dataType14 === "string" && data13 && data13 == +data13 && !(data13 % 1))){
595
+ coerced14 = +data13;
596
+ }
597
+ else {
598
+ validate10.errors = [{instancePath:instancePath+"/maxParamLength",schemaPath:"#/properties/maxParamLength/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
599
+ return false;
600
+ }
601
+ }
602
+ if(coerced14 !== undefined){
603
+ data13 = coerced14;
604
+ if(data !== undefined){
605
+ data["maxParamLength"] = coerced14;
606
+ }
607
+ }
608
+ }
609
+ var valid0 = _errs41 === errors;
610
+ if(valid0){
611
+ let data14 = data.onProtoPoisoning;
612
+ const _errs43 = errors;
613
+ if(typeof data14 !== "string"){
614
+ let dataType15 = typeof data14;
615
+ let coerced15 = undefined;
616
+ if(!(coerced15 !== undefined)){
617
+ if(dataType15 == "number" || dataType15 == "boolean"){
618
+ coerced15 = "" + data14;
619
+ }
620
+ else if(data14 === null){
621
+ coerced15 = "";
622
+ }
623
+ else {
624
+ validate10.errors = [{instancePath:instancePath+"/onProtoPoisoning",schemaPath:"#/properties/onProtoPoisoning/type",keyword:"type",params:{type: "string"},message:"must be string"}];
625
+ return false;
626
+ }
627
+ }
628
+ if(coerced15 !== undefined){
629
+ data14 = coerced15;
630
+ if(data !== undefined){
631
+ data["onProtoPoisoning"] = coerced15;
632
+ }
633
+ }
634
+ }
635
+ var valid0 = _errs43 === errors;
636
+ if(valid0){
637
+ let data15 = data.onConstructorPoisoning;
638
+ const _errs45 = errors;
639
+ if(typeof data15 !== "string"){
640
+ let dataType16 = typeof data15;
641
+ let coerced16 = undefined;
642
+ if(!(coerced16 !== undefined)){
643
+ if(dataType16 == "number" || dataType16 == "boolean"){
644
+ coerced16 = "" + data15;
645
+ }
646
+ else if(data15 === null){
647
+ coerced16 = "";
648
+ }
649
+ else {
650
+ validate10.errors = [{instancePath:instancePath+"/onConstructorPoisoning",schemaPath:"#/properties/onConstructorPoisoning/type",keyword:"type",params:{type: "string"},message:"must be string"}];
651
+ return false;
652
+ }
653
+ }
654
+ if(coerced16 !== undefined){
655
+ data15 = coerced16;
656
+ if(data !== undefined){
657
+ data["onConstructorPoisoning"] = coerced16;
658
+ }
659
+ }
660
+ }
661
+ var valid0 = _errs45 === errors;
662
+ if(valid0){
663
+ let data16 = data.pluginTimeout;
664
+ const _errs47 = errors;
665
+ if(!(((typeof data16 == "number") && (!(data16 % 1) && !isNaN(data16))) && (isFinite(data16)))){
666
+ let dataType17 = typeof data16;
667
+ let coerced17 = undefined;
668
+ if(!(coerced17 !== undefined)){
669
+ if(dataType17 === "boolean" || data16 === null
670
+ || (dataType17 === "string" && data16 && data16 == +data16 && !(data16 % 1))){
671
+ coerced17 = +data16;
672
+ }
673
+ else {
674
+ validate10.errors = [{instancePath:instancePath+"/pluginTimeout",schemaPath:"#/properties/pluginTimeout/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
675
+ return false;
676
+ }
677
+ }
678
+ if(coerced17 !== undefined){
679
+ data16 = coerced17;
680
+ if(data !== undefined){
681
+ data["pluginTimeout"] = coerced17;
682
+ }
683
+ }
684
+ }
685
+ var valid0 = _errs47 === errors;
686
+ if(valid0){
687
+ let data17 = data.requestIdHeader;
688
+ const _errs49 = errors;
689
+ if(typeof data17 !== "string"){
690
+ let dataType18 = typeof data17;
691
+ let coerced18 = undefined;
692
+ if(!(coerced18 !== undefined)){
693
+ if(dataType18 == "number" || dataType18 == "boolean"){
694
+ coerced18 = "" + data17;
695
+ }
696
+ else if(data17 === null){
697
+ coerced18 = "";
698
+ }
699
+ else {
700
+ validate10.errors = [{instancePath:instancePath+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/type",keyword:"type",params:{type: "string"},message:"must be string"}];
701
+ return false;
702
+ }
703
+ }
704
+ if(coerced18 !== undefined){
705
+ data17 = coerced18;
706
+ if(data !== undefined){
707
+ data["requestIdHeader"] = coerced18;
708
+ }
709
+ }
710
+ }
711
+ var valid0 = _errs49 === errors;
712
+ if(valid0){
713
+ let data18 = data.requestIdLogLabel;
714
+ const _errs51 = errors;
715
+ if(typeof data18 !== "string"){
716
+ let dataType19 = typeof data18;
717
+ let coerced19 = undefined;
718
+ if(!(coerced19 !== undefined)){
719
+ if(dataType19 == "number" || dataType19 == "boolean"){
720
+ coerced19 = "" + data18;
721
+ }
722
+ else if(data18 === null){
723
+ coerced19 = "";
724
+ }
725
+ else {
726
+ validate10.errors = [{instancePath:instancePath+"/requestIdLogLabel",schemaPath:"#/properties/requestIdLogLabel/type",keyword:"type",params:{type: "string"},message:"must be string"}];
727
+ return false;
728
+ }
729
+ }
730
+ if(coerced19 !== undefined){
731
+ data18 = coerced19;
732
+ if(data !== undefined){
733
+ data["requestIdLogLabel"] = coerced19;
734
+ }
735
+ }
736
+ }
737
+ var valid0 = _errs51 === errors;
738
+ if(valid0){
739
+ let data19 = data.http2SessionTimeout;
740
+ const _errs53 = errors;
741
+ if(!(((typeof data19 == "number") && (!(data19 % 1) && !isNaN(data19))) && (isFinite(data19)))){
742
+ let dataType20 = typeof data19;
743
+ let coerced20 = undefined;
744
+ if(!(coerced20 !== undefined)){
745
+ if(dataType20 === "boolean" || data19 === null
746
+ || (dataType20 === "string" && data19 && data19 == +data19 && !(data19 % 1))){
747
+ coerced20 = +data19;
748
+ }
749
+ else {
750
+ validate10.errors = [{instancePath:instancePath+"/http2SessionTimeout",schemaPath:"#/properties/http2SessionTimeout/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
751
+ return false;
752
+ }
753
+ }
754
+ if(coerced20 !== undefined){
755
+ data19 = coerced20;
756
+ if(data !== undefined){
757
+ data["http2SessionTimeout"] = coerced20;
758
+ }
759
+ }
760
+ }
761
+ var valid0 = _errs53 === errors;
762
+ if(valid0){
763
+ let data20 = data.exposeHeadRoutes;
764
+ const _errs55 = errors;
765
+ if(typeof data20 !== "boolean"){
766
+ let coerced21 = undefined;
767
+ if(!(coerced21 !== undefined)){
768
+ if(data20 === "false" || data20 === 0 || data20 === null){
769
+ coerced21 = false;
770
+ }
771
+ else if(data20 === "true" || data20 === 1){
772
+ coerced21 = true;
773
+ }
774
+ else {
775
+ validate10.errors = [{instancePath:instancePath+"/exposeHeadRoutes",schemaPath:"#/properties/exposeHeadRoutes/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
776
+ return false;
777
+ }
778
+ }
779
+ if(coerced21 !== undefined){
780
+ data20 = coerced21;
781
+ if(data !== undefined){
782
+ data["exposeHeadRoutes"] = coerced21;
783
+ }
784
+ }
785
+ }
786
+ var valid0 = _errs55 === errors;
787
+ if(valid0){
788
+ if(data.versioning !== undefined){
789
+ let data21 = data.versioning;
790
+ const _errs57 = errors;
791
+ if(errors === _errs57){
792
+ if(data21 && typeof data21 == "object" && !Array.isArray(data21)){
793
+ let missing1;
794
+ if(((data21.storage === undefined) && (missing1 = "storage")) || ((data21.deriveVersion === undefined) && (missing1 = "deriveVersion"))){
795
+ validate10.errors = [{instancePath:instancePath+"/versioning",schemaPath:"#/properties/versioning/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];
796
+ return false;
797
+ }
798
+ }
799
+ else {
800
+ validate10.errors = [{instancePath:instancePath+"/versioning",schemaPath:"#/properties/versioning/type",keyword:"type",params:{type: "object"},message:"must be object"}];
801
+ return false;
802
+ }
803
+ }
804
+ var valid0 = _errs57 === errors;
805
+ }
806
+ else {
807
+ var valid0 = true;
808
+ }
809
+ if(valid0){
810
+ if(data.constraints !== undefined){
811
+ let data22 = data.constraints;
812
+ const _errs60 = errors;
813
+ if(errors === _errs60){
814
+ if(data22 && typeof data22 == "object" && !Array.isArray(data22)){
815
+ for(const key2 in data22){
816
+ let data23 = data22[key2];
817
+ const _errs63 = errors;
818
+ if(errors === _errs63){
819
+ if(data23 && typeof data23 == "object" && !Array.isArray(data23)){
820
+ let missing2;
821
+ if(((((data23.name === undefined) && (missing2 = "name")) || ((data23.storage === undefined) && (missing2 = "storage"))) || ((data23.validate === undefined) && (missing2 = "validate"))) || ((data23.deriveConstraint === undefined) && (missing2 = "deriveConstraint"))){
822
+ validate10.errors = [{instancePath:instancePath+"/constraints/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/constraints/additionalProperties/required",keyword:"required",params:{missingProperty: missing2},message:"must have required property '"+missing2+"'"}];
823
+ return false;
824
+ }
825
+ else {
826
+ if(data23.name !== undefined){
827
+ let data24 = data23.name;
828
+ if(typeof data24 !== "string"){
829
+ let dataType22 = typeof data24;
830
+ let coerced22 = undefined;
831
+ if(!(coerced22 !== undefined)){
832
+ if(dataType22 == "number" || dataType22 == "boolean"){
833
+ coerced22 = "" + data24;
834
+ }
835
+ else if(data24 === null){
836
+ coerced22 = "";
837
+ }
838
+ else {
839
+ validate10.errors = [{instancePath:instancePath+"/constraints/" + key2.replace(/~/g, "~0").replace(/\//g, "~1")+"/name",schemaPath:"#/properties/constraints/additionalProperties/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];
840
+ return false;
841
+ }
842
+ }
843
+ if(coerced22 !== undefined){
844
+ data24 = coerced22;
845
+ if(data23 !== undefined){
846
+ data23["name"] = coerced22;
847
+ }
848
+ }
849
+ }
850
+ }
851
+ }
852
+ }
853
+ else {
854
+ validate10.errors = [{instancePath:instancePath+"/constraints/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/constraints/additionalProperties/type",keyword:"type",params:{type: "object"},message:"must be object"}];
855
+ return false;
856
+ }
857
+ }
858
+ var valid5 = _errs63 === errors;
859
+ if(!valid5){
860
+ break;
861
+ }
862
+ }
863
+ }
864
+ else {
865
+ validate10.errors = [{instancePath:instancePath+"/constraints",schemaPath:"#/properties/constraints/type",keyword:"type",params:{type: "object"},message:"must be object"}];
866
+ return false;
867
+ }
868
+ }
869
+ var valid0 = _errs60 === errors;
870
+ }
871
+ else {
872
+ var valid0 = true;
873
+ }
874
+ }
875
+ }
876
+ }
877
+ }
878
+ }
879
+ }
880
+ }
881
+ }
882
+ }
883
+ }
884
+ }
885
+ }
886
+ }
887
+ }
888
+ }
889
+ }
890
+ }
891
+ }
892
+ }
893
+ }
894
+ }
895
+ }
896
+ }
897
+ else {
898
+ validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];
899
+ return false;
900
+ }
901
+ }
902
+ validate10.errors = vErrors;
903
+ return errors === 0;
904
+ }
905
+
1027
906
 
1028
- module.exports.defaultInitOptions = {"connectionTimeout":0,"keepAliveTimeout":5000,"maxRequestsPerSocket":0,"requestTimeout":0,"bodyLimit":1048576,"caseSensitive":true,"disableRequestLogging":false,"jsonShorthand":true,"ignoreTrailingSlash":false,"maxParamLength":100,"onProtoPoisoning":"error","onConstructorPoisoning":"error","pluginTimeout":10000,"requestIdHeader":"request-id","requestIdLogLabel":"reqId","http2SessionTimeout":5000}
907
+ module.exports.defaultInitOptions = {"connectionTimeout":0,"keepAliveTimeout":72000,"forceCloseConnections":false,"maxRequestsPerSocket":0,"requestTimeout":0,"bodyLimit":1048576,"caseSensitive":true,"disableRequestLogging":false,"jsonShorthand":true,"ignoreTrailingSlash":false,"maxParamLength":100,"onProtoPoisoning":"error","onConstructorPoisoning":"error","pluginTimeout":10000,"requestIdHeader":"request-id","requestIdLogLabel":"reqId","http2SessionTimeout":72000,"exposeHeadRoutes":true}