1 |
|
2 |
|
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":{"oneOf":[{"type":"string","pattern":"idle"},{"type":"boolean"}]},"maxRequestsPerSocket":{"type":"integer","default":0,"nullable":true},"requestTimeout":{"type":"integer","default":0},"bodyLimit":{"type":"integer","default":1048576},"caseSensitive":{"type":"boolean","default":true},"allowUnsafeRegex":{"type":"boolean","default":false},"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},"ignoreDuplicateSlashes":{"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":{"anyOf":[{"enum":[false]},{"type":"string"}],"default":"request-id"},"requestIdLogLabel":{"type":"string","default":"reqId"},"http2SessionTimeout":{"type":"integer","default":72000},"exposeHeadRoutes":{"type":"boolean","default":true},"useSemicolonDelimiter":{"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 func2 = Object.prototype.hasOwnProperty;
|
8 | const pattern0 = new RegExp("idle", "u");
|
9 |
|
10 | function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){
|
11 | let vErrors = null;
|
12 | let errors = 0;
|
13 | if(errors === 0){
|
14 | if(data && typeof data == "object" && !Array.isArray(data)){
|
15 | if(data.connectionTimeout === undefined){
|
16 | data.connectionTimeout = 0;
|
17 | }
|
18 | if(data.keepAliveTimeout === undefined){
|
19 | data.keepAliveTimeout = 72000;
|
20 | }
|
21 | if(data.maxRequestsPerSocket === undefined){
|
22 | data.maxRequestsPerSocket = 0;
|
23 | }
|
24 | if(data.requestTimeout === undefined){
|
25 | data.requestTimeout = 0;
|
26 | }
|
27 | if(data.bodyLimit === undefined){
|
28 | data.bodyLimit = 1048576;
|
29 | }
|
30 | if(data.caseSensitive === undefined){
|
31 | data.caseSensitive = true;
|
32 | }
|
33 | if(data.allowUnsafeRegex === undefined){
|
34 | data.allowUnsafeRegex = false;
|
35 | }
|
36 | if(data.ignoreTrailingSlash === undefined){
|
37 | data.ignoreTrailingSlash = false;
|
38 | }
|
39 | if(data.ignoreDuplicateSlashes === undefined){
|
40 | data.ignoreDuplicateSlashes = false;
|
41 | }
|
42 | if(data.disableRequestLogging === undefined){
|
43 | data.disableRequestLogging = false;
|
44 | }
|
45 | if(data.jsonShorthand === undefined){
|
46 | data.jsonShorthand = true;
|
47 | }
|
48 | if(data.maxParamLength === undefined){
|
49 | data.maxParamLength = 100;
|
50 | }
|
51 | if(data.onProtoPoisoning === undefined){
|
52 | data.onProtoPoisoning = "error";
|
53 | }
|
54 | if(data.onConstructorPoisoning === undefined){
|
55 | data.onConstructorPoisoning = "error";
|
56 | }
|
57 | if(data.pluginTimeout === undefined){
|
58 | data.pluginTimeout = 10000;
|
59 | }
|
60 | if(data.requestIdHeader === undefined){
|
61 | data.requestIdHeader = "request-id";
|
62 | }
|
63 | if(data.requestIdLogLabel === undefined){
|
64 | data.requestIdLogLabel = "reqId";
|
65 | }
|
66 | if(data.http2SessionTimeout === undefined){
|
67 | data.http2SessionTimeout = 72000;
|
68 | }
|
69 | if(data.exposeHeadRoutes === undefined){
|
70 | data.exposeHeadRoutes = true;
|
71 | }
|
72 | if(data.useSemicolonDelimiter === undefined){
|
73 | data.useSemicolonDelimiter = true;
|
74 | }
|
75 | const _errs1 = errors;
|
76 | for(const key0 in data){
|
77 | if(!(func2.call(schema11.properties, key0))){
|
78 | delete data[key0];
|
79 | }
|
80 | }
|
81 | if(_errs1 === errors){
|
82 | let data0 = data.connectionTimeout;
|
83 | const _errs2 = errors;
|
84 | if(!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))){
|
85 | let dataType0 = typeof data0;
|
86 | let coerced0 = undefined;
|
87 | if(!(coerced0 !== undefined)){
|
88 | if(dataType0 === "boolean" || data0 === null
|
89 | || (dataType0 === "string" && data0 && data0 == +data0 && !(data0 % 1))){
|
90 | coerced0 = +data0;
|
91 | }
|
92 | else {
|
93 | validate10.errors = [{instancePath:instancePath+"/connectionTimeout",schemaPath:"#/properties/connectionTimeout/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
|
94 | return false;
|
95 | }
|
96 | }
|
97 | if(coerced0 !== undefined){
|
98 | data0 = coerced0;
|
99 | if(data !== undefined){
|
100 | data["connectionTimeout"] = coerced0;
|
101 | }
|
102 | }
|
103 | }
|
104 | var valid0 = _errs2 === errors;
|
105 | if(valid0){
|
106 | let data1 = data.keepAliveTimeout;
|
107 | const _errs4 = errors;
|
108 | if(!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))){
|
109 | let dataType1 = typeof data1;
|
110 | let coerced1 = undefined;
|
111 | if(!(coerced1 !== undefined)){
|
112 | if(dataType1 === "boolean" || data1 === null
|
113 | || (dataType1 === "string" && data1 && data1 == +data1 && !(data1 % 1))){
|
114 | coerced1 = +data1;
|
115 | }
|
116 | else {
|
117 | validate10.errors = [{instancePath:instancePath+"/keepAliveTimeout",schemaPath:"#/properties/keepAliveTimeout/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
|
118 | return false;
|
119 | }
|
120 | }
|
121 | if(coerced1 !== undefined){
|
122 | data1 = coerced1;
|
123 | if(data !== undefined){
|
124 | data["keepAliveTimeout"] = coerced1;
|
125 | }
|
126 | }
|
127 | }
|
128 | var valid0 = _errs4 === errors;
|
129 | if(valid0){
|
130 | if(data.forceCloseConnections !== undefined){
|
131 | let data2 = data.forceCloseConnections;
|
132 | const _errs6 = errors;
|
133 | const _errs7 = errors;
|
134 | let valid1 = false;
|
135 | let passing0 = null;
|
136 | const _errs8 = errors;
|
137 | if(typeof data2 !== "string"){
|
138 | let dataType2 = typeof data2;
|
139 | let coerced2 = undefined;
|
140 | if(!(coerced2 !== undefined)){
|
141 | if(dataType2 == "number" || dataType2 == "boolean"){
|
142 | coerced2 = "" + data2;
|
143 | }
|
144 | else if(data2 === null){
|
145 | coerced2 = "";
|
146 | }
|
147 | else {
|
148 | const err0 = {instancePath:instancePath+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
149 | if(vErrors === null){
|
150 | vErrors = [err0];
|
151 | }
|
152 | else {
|
153 | vErrors.push(err0);
|
154 | }
|
155 | errors++;
|
156 | }
|
157 | }
|
158 | if(coerced2 !== undefined){
|
159 | data2 = coerced2;
|
160 | if(data !== undefined){
|
161 | data["forceCloseConnections"] = coerced2;
|
162 | }
|
163 | }
|
164 | }
|
165 | if(errors === _errs8){
|
166 | if(typeof data2 === "string"){
|
167 | if(!pattern0.test(data2)){
|
168 | const err1 = {instancePath:instancePath+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/pattern",keyword:"pattern",params:{pattern: "idle"},message:"must match pattern \""+"idle"+"\""};
|
169 | if(vErrors === null){
|
170 | vErrors = [err1];
|
171 | }
|
172 | else {
|
173 | vErrors.push(err1);
|
174 | }
|
175 | errors++;
|
176 | }
|
177 | }
|
178 | }
|
179 | var _valid0 = _errs8 === errors;
|
180 | if(_valid0){
|
181 | valid1 = true;
|
182 | passing0 = 0;
|
183 | }
|
184 | const _errs10 = errors;
|
185 | if(typeof data2 !== "boolean"){
|
186 | let coerced3 = undefined;
|
187 | if(!(coerced3 !== undefined)){
|
188 | if(data2 === "false" || data2 === 0 || data2 === null){
|
189 | coerced3 = false;
|
190 | }
|
191 | else if(data2 === "true" || data2 === 1){
|
192 | coerced3 = true;
|
193 | }
|
194 | else {
|
195 | const err2 = {instancePath:instancePath+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/1/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
|
196 | if(vErrors === null){
|
197 | vErrors = [err2];
|
198 | }
|
199 | else {
|
200 | vErrors.push(err2);
|
201 | }
|
202 | errors++;
|
203 | }
|
204 | }
|
205 | if(coerced3 !== undefined){
|
206 | data2 = coerced3;
|
207 | if(data !== undefined){
|
208 | data["forceCloseConnections"] = coerced3;
|
209 | }
|
210 | }
|
211 | }
|
212 | var _valid0 = _errs10 === errors;
|
213 | if(_valid0 && valid1){
|
214 | valid1 = false;
|
215 | passing0 = [passing0, 1];
|
216 | }
|
217 | else {
|
218 | if(_valid0){
|
219 | valid1 = true;
|
220 | passing0 = 1;
|
221 | }
|
222 | }
|
223 | if(!valid1){
|
224 | const err3 = {instancePath:instancePath+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};
|
225 | if(vErrors === null){
|
226 | vErrors = [err3];
|
227 | }
|
228 | else {
|
229 | vErrors.push(err3);
|
230 | }
|
231 | errors++;
|
232 | validate10.errors = vErrors;
|
233 | return false;
|
234 | }
|
235 | else {
|
236 | errors = _errs7;
|
237 | if(vErrors !== null){
|
238 | if(_errs7){
|
239 | vErrors.length = _errs7;
|
240 | }
|
241 | else {
|
242 | vErrors = null;
|
243 | }
|
244 | }
|
245 | }
|
246 | var valid0 = _errs6 === errors;
|
247 | }
|
248 | else {
|
249 | var valid0 = true;
|
250 | }
|
251 | if(valid0){
|
252 | let data3 = data.maxRequestsPerSocket;
|
253 | const _errs12 = errors;
|
254 | if((!(((typeof data3 == "number") && (!(data3 % 1) && !isNaN(data3))) && (isFinite(data3)))) && (data3 !== null)){
|
255 | let dataType4 = typeof data3;
|
256 | let coerced4 = undefined;
|
257 | if(!(coerced4 !== undefined)){
|
258 | if(dataType4 === "boolean" || data3 === null
|
259 | || (dataType4 === "string" && data3 && data3 == +data3 && !(data3 % 1))){
|
260 | coerced4 = +data3;
|
261 | }
|
262 | else if(data3 === "" || data3 === 0 || data3 === false){
|
263 | coerced4 = null;
|
264 | }
|
265 | else {
|
266 | validate10.errors = [{instancePath:instancePath+"/maxRequestsPerSocket",schemaPath:"#/properties/maxRequestsPerSocket/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
|
267 | return false;
|
268 | }
|
269 | }
|
270 | if(coerced4 !== undefined){
|
271 | data3 = coerced4;
|
272 | if(data !== undefined){
|
273 | data["maxRequestsPerSocket"] = coerced4;
|
274 | }
|
275 | }
|
276 | }
|
277 | var valid0 = _errs12 === errors;
|
278 | if(valid0){
|
279 | let data4 = data.requestTimeout;
|
280 | const _errs15 = errors;
|
281 | if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){
|
282 | let dataType5 = typeof data4;
|
283 | let coerced5 = undefined;
|
284 | if(!(coerced5 !== undefined)){
|
285 | if(dataType5 === "boolean" || data4 === null
|
286 | || (dataType5 === "string" && data4 && data4 == +data4 && !(data4 % 1))){
|
287 | coerced5 = +data4;
|
288 | }
|
289 | else {
|
290 | validate10.errors = [{instancePath:instancePath+"/requestTimeout",schemaPath:"#/properties/requestTimeout/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
|
291 | return false;
|
292 | }
|
293 | }
|
294 | if(coerced5 !== undefined){
|
295 | data4 = coerced5;
|
296 | if(data !== undefined){
|
297 | data["requestTimeout"] = coerced5;
|
298 | }
|
299 | }
|
300 | }
|
301 | var valid0 = _errs15 === errors;
|
302 | if(valid0){
|
303 | let data5 = data.bodyLimit;
|
304 | const _errs17 = errors;
|
305 | if(!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))){
|
306 | let dataType6 = typeof data5;
|
307 | let coerced6 = undefined;
|
308 | if(!(coerced6 !== undefined)){
|
309 | if(dataType6 === "boolean" || data5 === null
|
310 | || (dataType6 === "string" && data5 && data5 == +data5 && !(data5 % 1))){
|
311 | coerced6 = +data5;
|
312 | }
|
313 | else {
|
314 | validate10.errors = [{instancePath:instancePath+"/bodyLimit",schemaPath:"#/properties/bodyLimit/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
|
315 | return false;
|
316 | }
|
317 | }
|
318 | if(coerced6 !== undefined){
|
319 | data5 = coerced6;
|
320 | if(data !== undefined){
|
321 | data["bodyLimit"] = coerced6;
|
322 | }
|
323 | }
|
324 | }
|
325 | var valid0 = _errs17 === errors;
|
326 | if(valid0){
|
327 | let data6 = data.caseSensitive;
|
328 | const _errs19 = errors;
|
329 | if(typeof data6 !== "boolean"){
|
330 | let coerced7 = undefined;
|
331 | if(!(coerced7 !== undefined)){
|
332 | if(data6 === "false" || data6 === 0 || data6 === null){
|
333 | coerced7 = false;
|
334 | }
|
335 | else if(data6 === "true" || data6 === 1){
|
336 | coerced7 = true;
|
337 | }
|
338 | else {
|
339 | validate10.errors = [{instancePath:instancePath+"/caseSensitive",schemaPath:"#/properties/caseSensitive/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
|
340 | return false;
|
341 | }
|
342 | }
|
343 | if(coerced7 !== undefined){
|
344 | data6 = coerced7;
|
345 | if(data !== undefined){
|
346 | data["caseSensitive"] = coerced7;
|
347 | }
|
348 | }
|
349 | }
|
350 | var valid0 = _errs19 === errors;
|
351 | if(valid0){
|
352 | let data7 = data.allowUnsafeRegex;
|
353 | const _errs21 = errors;
|
354 | if(typeof data7 !== "boolean"){
|
355 | let coerced8 = undefined;
|
356 | if(!(coerced8 !== undefined)){
|
357 | if(data7 === "false" || data7 === 0 || data7 === null){
|
358 | coerced8 = false;
|
359 | }
|
360 | else if(data7 === "true" || data7 === 1){
|
361 | coerced8 = true;
|
362 | }
|
363 | else {
|
364 | validate10.errors = [{instancePath:instancePath+"/allowUnsafeRegex",schemaPath:"#/properties/allowUnsafeRegex/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
|
365 | return false;
|
366 | }
|
367 | }
|
368 | if(coerced8 !== undefined){
|
369 | data7 = coerced8;
|
370 | if(data !== undefined){
|
371 | data["allowUnsafeRegex"] = coerced8;
|
372 | }
|
373 | }
|
374 | }
|
375 | var valid0 = _errs21 === errors;
|
376 | if(valid0){
|
377 | if(data.http2 !== undefined){
|
378 | let data8 = data.http2;
|
379 | const _errs23 = errors;
|
380 | if(typeof data8 !== "boolean"){
|
381 | let coerced9 = undefined;
|
382 | if(!(coerced9 !== undefined)){
|
383 | if(data8 === "false" || data8 === 0 || data8 === null){
|
384 | coerced9 = false;
|
385 | }
|
386 | else if(data8 === "true" || data8 === 1){
|
387 | coerced9 = true;
|
388 | }
|
389 | else {
|
390 | validate10.errors = [{instancePath:instancePath+"/http2",schemaPath:"#/properties/http2/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
|
391 | return false;
|
392 | }
|
393 | }
|
394 | if(coerced9 !== undefined){
|
395 | data8 = coerced9;
|
396 | if(data !== undefined){
|
397 | data["http2"] = coerced9;
|
398 | }
|
399 | }
|
400 | }
|
401 | var valid0 = _errs23 === errors;
|
402 | }
|
403 | else {
|
404 | var valid0 = true;
|
405 | }
|
406 | if(valid0){
|
407 | if(data.https !== undefined){
|
408 | let data9 = data.https;
|
409 | const _errs25 = errors;
|
410 | const _errs26 = errors;
|
411 | let valid2 = true;
|
412 | const _errs27 = errors;
|
413 | const _errs28 = errors;
|
414 | const _errs29 = errors;
|
415 | const _errs30 = errors;
|
416 | let valid4 = false;
|
417 | let passing1 = null;
|
418 | const _errs31 = errors;
|
419 | if(typeof data9 !== "boolean"){
|
420 | let coerced10 = undefined;
|
421 | if(!(coerced10 !== undefined)){
|
422 | if(data9 === "false" || data9 === 0 || data9 === null){
|
423 | coerced10 = false;
|
424 | }
|
425 | else if(data9 === "true" || data9 === 1){
|
426 | coerced10 = true;
|
427 | }
|
428 | else {
|
429 | const err4 = {};
|
430 | if(vErrors === null){
|
431 | vErrors = [err4];
|
432 | }
|
433 | else {
|
434 | vErrors.push(err4);
|
435 | }
|
436 | errors++;
|
437 | }
|
438 | }
|
439 | if(coerced10 !== undefined){
|
440 | data9 = coerced10;
|
441 | if(data !== undefined){
|
442 | data["https"] = coerced10;
|
443 | }
|
444 | }
|
445 | }
|
446 | var _valid2 = _errs31 === errors;
|
447 | if(_valid2){
|
448 | valid4 = true;
|
449 | passing1 = 0;
|
450 | }
|
451 | const _errs33 = errors;
|
452 | if(data9 !== null){
|
453 | let coerced11 = undefined;
|
454 | if(!(coerced11 !== undefined)){
|
455 | if(data9 === "" || data9 === 0 || data9 === false){
|
456 | coerced11 = null;
|
457 | }
|
458 | else {
|
459 | const err5 = {};
|
460 | if(vErrors === null){
|
461 | vErrors = [err5];
|
462 | }
|
463 | else {
|
464 | vErrors.push(err5);
|
465 | }
|
466 | errors++;
|
467 | }
|
468 | }
|
469 | if(coerced11 !== undefined){
|
470 | data9 = coerced11;
|
471 | if(data !== undefined){
|
472 | data["https"] = coerced11;
|
473 | }
|
474 | }
|
475 | }
|
476 | var _valid2 = _errs33 === errors;
|
477 | if(_valid2 && valid4){
|
478 | valid4 = false;
|
479 | passing1 = [passing1, 1];
|
480 | }
|
481 | else {
|
482 | if(_valid2){
|
483 | valid4 = true;
|
484 | passing1 = 1;
|
485 | }
|
486 | const _errs35 = errors;
|
487 | if(errors === _errs35){
|
488 | if(data9 && typeof data9 == "object" && !Array.isArray(data9)){
|
489 | let missing0;
|
490 | if((data9.allowHTTP1 === undefined) && (missing0 = "allowHTTP1")){
|
491 | const err6 = {};
|
492 | if(vErrors === null){
|
493 | vErrors = [err6];
|
494 | }
|
495 | else {
|
496 | vErrors.push(err6);
|
497 | }
|
498 | errors++;
|
499 | }
|
500 | else {
|
501 | const _errs37 = errors;
|
502 | for(const key1 in data9){
|
503 | if(!(key1 === "allowHTTP1")){
|
504 | delete data9[key1];
|
505 | }
|
506 | }
|
507 | if(_errs37 === errors){
|
508 | if(data9.allowHTTP1 !== undefined){
|
509 | let data10 = data9.allowHTTP1;
|
510 | if(typeof data10 !== "boolean"){
|
511 | let coerced12 = undefined;
|
512 | if(!(coerced12 !== undefined)){
|
513 | if(data10 === "false" || data10 === 0 || data10 === null){
|
514 | coerced12 = false;
|
515 | }
|
516 | else if(data10 === "true" || data10 === 1){
|
517 | coerced12 = true;
|
518 | }
|
519 | else {
|
520 | const err7 = {};
|
521 | if(vErrors === null){
|
522 | vErrors = [err7];
|
523 | }
|
524 | else {
|
525 | vErrors.push(err7);
|
526 | }
|
527 | errors++;
|
528 | }
|
529 | }
|
530 | if(coerced12 !== undefined){
|
531 | data10 = coerced12;
|
532 | if(data9 !== undefined){
|
533 | data9["allowHTTP1"] = coerced12;
|
534 | }
|
535 | }
|
536 | }
|
537 | }
|
538 | }
|
539 | }
|
540 | }
|
541 | else {
|
542 | const err8 = {};
|
543 | if(vErrors === null){
|
544 | vErrors = [err8];
|
545 | }
|
546 | else {
|
547 | vErrors.push(err8);
|
548 | }
|
549 | errors++;
|
550 | }
|
551 | }
|
552 | var _valid2 = _errs35 === errors;
|
553 | if(_valid2 && valid4){
|
554 | valid4 = false;
|
555 | passing1 = [passing1, 2];
|
556 | }
|
557 | else {
|
558 | if(_valid2){
|
559 | valid4 = true;
|
560 | passing1 = 2;
|
561 | }
|
562 | }
|
563 | }
|
564 | if(!valid4){
|
565 | const err9 = {};
|
566 | if(vErrors === null){
|
567 | vErrors = [err9];
|
568 | }
|
569 | else {
|
570 | vErrors.push(err9);
|
571 | }
|
572 | errors++;
|
573 | }
|
574 | else {
|
575 | errors = _errs30;
|
576 | if(vErrors !== null){
|
577 | if(_errs30){
|
578 | vErrors.length = _errs30;
|
579 | }
|
580 | else {
|
581 | vErrors = null;
|
582 | }
|
583 | }
|
584 | }
|
585 | var valid3 = _errs29 === errors;
|
586 | if(valid3){
|
587 | const err10 = {};
|
588 | if(vErrors === null){
|
589 | vErrors = [err10];
|
590 | }
|
591 | else {
|
592 | vErrors.push(err10);
|
593 | }
|
594 | errors++;
|
595 | }
|
596 | else {
|
597 | errors = _errs28;
|
598 | if(vErrors !== null){
|
599 | if(_errs28){
|
600 | vErrors.length = _errs28;
|
601 | }
|
602 | else {
|
603 | vErrors = null;
|
604 | }
|
605 | }
|
606 | }
|
607 | var _valid1 = _errs27 === errors;
|
608 | errors = _errs26;
|
609 | if(vErrors !== null){
|
610 | if(_errs26){
|
611 | vErrors.length = _errs26;
|
612 | }
|
613 | else {
|
614 | vErrors = null;
|
615 | }
|
616 | }
|
617 | if(_valid1){
|
618 | const _errs40 = errors;
|
619 | data["https"] = true;
|
620 | var _valid1 = _errs40 === errors;
|
621 | valid2 = _valid1;
|
622 | }
|
623 | if(!valid2){
|
624 | const err11 = {instancePath:instancePath+"/https",schemaPath:"#/properties/https/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};
|
625 | if(vErrors === null){
|
626 | vErrors = [err11];
|
627 | }
|
628 | else {
|
629 | vErrors.push(err11);
|
630 | }
|
631 | errors++;
|
632 | validate10.errors = vErrors;
|
633 | return false;
|
634 | }
|
635 | var valid0 = _errs25 === errors;
|
636 | }
|
637 | else {
|
638 | var valid0 = true;
|
639 | }
|
640 | if(valid0){
|
641 | let data11 = data.ignoreTrailingSlash;
|
642 | const _errs41 = errors;
|
643 | if(typeof data11 !== "boolean"){
|
644 | let coerced13 = undefined;
|
645 | if(!(coerced13 !== undefined)){
|
646 | if(data11 === "false" || data11 === 0 || data11 === null){
|
647 | coerced13 = false;
|
648 | }
|
649 | else if(data11 === "true" || data11 === 1){
|
650 | coerced13 = true;
|
651 | }
|
652 | else {
|
653 | validate10.errors = [{instancePath:instancePath+"/ignoreTrailingSlash",schemaPath:"#/properties/ignoreTrailingSlash/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
|
654 | return false;
|
655 | }
|
656 | }
|
657 | if(coerced13 !== undefined){
|
658 | data11 = coerced13;
|
659 | if(data !== undefined){
|
660 | data["ignoreTrailingSlash"] = coerced13;
|
661 | }
|
662 | }
|
663 | }
|
664 | var valid0 = _errs41 === errors;
|
665 | if(valid0){
|
666 | let data12 = data.ignoreDuplicateSlashes;
|
667 | const _errs43 = errors;
|
668 | if(typeof data12 !== "boolean"){
|
669 | let coerced14 = undefined;
|
670 | if(!(coerced14 !== undefined)){
|
671 | if(data12 === "false" || data12 === 0 || data12 === null){
|
672 | coerced14 = false;
|
673 | }
|
674 | else if(data12 === "true" || data12 === 1){
|
675 | coerced14 = true;
|
676 | }
|
677 | else {
|
678 | validate10.errors = [{instancePath:instancePath+"/ignoreDuplicateSlashes",schemaPath:"#/properties/ignoreDuplicateSlashes/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
|
679 | return false;
|
680 | }
|
681 | }
|
682 | if(coerced14 !== undefined){
|
683 | data12 = coerced14;
|
684 | if(data !== undefined){
|
685 | data["ignoreDuplicateSlashes"] = coerced14;
|
686 | }
|
687 | }
|
688 | }
|
689 | var valid0 = _errs43 === errors;
|
690 | if(valid0){
|
691 | let data13 = data.disableRequestLogging;
|
692 | const _errs45 = errors;
|
693 | if(typeof data13 !== "boolean"){
|
694 | let coerced15 = undefined;
|
695 | if(!(coerced15 !== undefined)){
|
696 | if(data13 === "false" || data13 === 0 || data13 === null){
|
697 | coerced15 = false;
|
698 | }
|
699 | else if(data13 === "true" || data13 === 1){
|
700 | coerced15 = true;
|
701 | }
|
702 | else {
|
703 | validate10.errors = [{instancePath:instancePath+"/disableRequestLogging",schemaPath:"#/properties/disableRequestLogging/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
|
704 | return false;
|
705 | }
|
706 | }
|
707 | if(coerced15 !== undefined){
|
708 | data13 = coerced15;
|
709 | if(data !== undefined){
|
710 | data["disableRequestLogging"] = coerced15;
|
711 | }
|
712 | }
|
713 | }
|
714 | var valid0 = _errs45 === errors;
|
715 | if(valid0){
|
716 | let data14 = data.jsonShorthand;
|
717 | const _errs47 = errors;
|
718 | if(typeof data14 !== "boolean"){
|
719 | let coerced16 = undefined;
|
720 | if(!(coerced16 !== undefined)){
|
721 | if(data14 === "false" || data14 === 0 || data14 === null){
|
722 | coerced16 = false;
|
723 | }
|
724 | else if(data14 === "true" || data14 === 1){
|
725 | coerced16 = true;
|
726 | }
|
727 | else {
|
728 | validate10.errors = [{instancePath:instancePath+"/jsonShorthand",schemaPath:"#/properties/jsonShorthand/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
|
729 | return false;
|
730 | }
|
731 | }
|
732 | if(coerced16 !== undefined){
|
733 | data14 = coerced16;
|
734 | if(data !== undefined){
|
735 | data["jsonShorthand"] = coerced16;
|
736 | }
|
737 | }
|
738 | }
|
739 | var valid0 = _errs47 === errors;
|
740 | if(valid0){
|
741 | let data15 = data.maxParamLength;
|
742 | const _errs49 = errors;
|
743 | if(!(((typeof data15 == "number") && (!(data15 % 1) && !isNaN(data15))) && (isFinite(data15)))){
|
744 | let dataType17 = typeof data15;
|
745 | let coerced17 = undefined;
|
746 | if(!(coerced17 !== undefined)){
|
747 | if(dataType17 === "boolean" || data15 === null
|
748 | || (dataType17 === "string" && data15 && data15 == +data15 && !(data15 % 1))){
|
749 | coerced17 = +data15;
|
750 | }
|
751 | else {
|
752 | validate10.errors = [{instancePath:instancePath+"/maxParamLength",schemaPath:"#/properties/maxParamLength/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
|
753 | return false;
|
754 | }
|
755 | }
|
756 | if(coerced17 !== undefined){
|
757 | data15 = coerced17;
|
758 | if(data !== undefined){
|
759 | data["maxParamLength"] = coerced17;
|
760 | }
|
761 | }
|
762 | }
|
763 | var valid0 = _errs49 === errors;
|
764 | if(valid0){
|
765 | let data16 = data.onProtoPoisoning;
|
766 | const _errs51 = errors;
|
767 | if(typeof data16 !== "string"){
|
768 | let dataType18 = typeof data16;
|
769 | let coerced18 = undefined;
|
770 | if(!(coerced18 !== undefined)){
|
771 | if(dataType18 == "number" || dataType18 == "boolean"){
|
772 | coerced18 = "" + data16;
|
773 | }
|
774 | else if(data16 === null){
|
775 | coerced18 = "";
|
776 | }
|
777 | else {
|
778 | validate10.errors = [{instancePath:instancePath+"/onProtoPoisoning",schemaPath:"#/properties/onProtoPoisoning/type",keyword:"type",params:{type: "string"},message:"must be string"}];
|
779 | return false;
|
780 | }
|
781 | }
|
782 | if(coerced18 !== undefined){
|
783 | data16 = coerced18;
|
784 | if(data !== undefined){
|
785 | data["onProtoPoisoning"] = coerced18;
|
786 | }
|
787 | }
|
788 | }
|
789 | var valid0 = _errs51 === errors;
|
790 | if(valid0){
|
791 | let data17 = data.onConstructorPoisoning;
|
792 | const _errs53 = errors;
|
793 | if(typeof data17 !== "string"){
|
794 | let dataType19 = typeof data17;
|
795 | let coerced19 = undefined;
|
796 | if(!(coerced19 !== undefined)){
|
797 | if(dataType19 == "number" || dataType19 == "boolean"){
|
798 | coerced19 = "" + data17;
|
799 | }
|
800 | else if(data17 === null){
|
801 | coerced19 = "";
|
802 | }
|
803 | else {
|
804 | validate10.errors = [{instancePath:instancePath+"/onConstructorPoisoning",schemaPath:"#/properties/onConstructorPoisoning/type",keyword:"type",params:{type: "string"},message:"must be string"}];
|
805 | return false;
|
806 | }
|
807 | }
|
808 | if(coerced19 !== undefined){
|
809 | data17 = coerced19;
|
810 | if(data !== undefined){
|
811 | data["onConstructorPoisoning"] = coerced19;
|
812 | }
|
813 | }
|
814 | }
|
815 | var valid0 = _errs53 === errors;
|
816 | if(valid0){
|
817 | let data18 = data.pluginTimeout;
|
818 | const _errs55 = errors;
|
819 | if(!(((typeof data18 == "number") && (!(data18 % 1) && !isNaN(data18))) && (isFinite(data18)))){
|
820 | let dataType20 = typeof data18;
|
821 | let coerced20 = undefined;
|
822 | if(!(coerced20 !== undefined)){
|
823 | if(dataType20 === "boolean" || data18 === null
|
824 | || (dataType20 === "string" && data18 && data18 == +data18 && !(data18 % 1))){
|
825 | coerced20 = +data18;
|
826 | }
|
827 | else {
|
828 | validate10.errors = [{instancePath:instancePath+"/pluginTimeout",schemaPath:"#/properties/pluginTimeout/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
|
829 | return false;
|
830 | }
|
831 | }
|
832 | if(coerced20 !== undefined){
|
833 | data18 = coerced20;
|
834 | if(data !== undefined){
|
835 | data["pluginTimeout"] = coerced20;
|
836 | }
|
837 | }
|
838 | }
|
839 | var valid0 = _errs55 === errors;
|
840 | if(valid0){
|
841 | let data19 = data.requestIdHeader;
|
842 | const _errs57 = errors;
|
843 | const _errs58 = errors;
|
844 | let valid6 = false;
|
845 | const _errs59 = errors;
|
846 | if(!(data19 === false)){
|
847 | const err12 = {instancePath:instancePath+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf/0/enum",keyword:"enum",params:{allowedValues: schema11.properties.requestIdHeader.anyOf[0].enum},message:"must be equal to one of the allowed values"};
|
848 | if(vErrors === null){
|
849 | vErrors = [err12];
|
850 | }
|
851 | else {
|
852 | vErrors.push(err12);
|
853 | }
|
854 | errors++;
|
855 | }
|
856 | var _valid3 = _errs59 === errors;
|
857 | valid6 = valid6 || _valid3;
|
858 | if(!valid6){
|
859 | const _errs60 = errors;
|
860 | if(typeof data19 !== "string"){
|
861 | let dataType21 = typeof data19;
|
862 | let coerced21 = undefined;
|
863 | if(!(coerced21 !== undefined)){
|
864 | if(dataType21 == "number" || dataType21 == "boolean"){
|
865 | coerced21 = "" + data19;
|
866 | }
|
867 | else if(data19 === null){
|
868 | coerced21 = "";
|
869 | }
|
870 | else {
|
871 | const err13 = {instancePath:instancePath+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf/1/type",keyword:"type",params:{type: "string"},message:"must be string"};
|
872 | if(vErrors === null){
|
873 | vErrors = [err13];
|
874 | }
|
875 | else {
|
876 | vErrors.push(err13);
|
877 | }
|
878 | errors++;
|
879 | }
|
880 | }
|
881 | if(coerced21 !== undefined){
|
882 | data19 = coerced21;
|
883 | if(data !== undefined){
|
884 | data["requestIdHeader"] = coerced21;
|
885 | }
|
886 | }
|
887 | }
|
888 | var _valid3 = _errs60 === errors;
|
889 | valid6 = valid6 || _valid3;
|
890 | }
|
891 | if(!valid6){
|
892 | const err14 = {instancePath:instancePath+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};
|
893 | if(vErrors === null){
|
894 | vErrors = [err14];
|
895 | }
|
896 | else {
|
897 | vErrors.push(err14);
|
898 | }
|
899 | errors++;
|
900 | validate10.errors = vErrors;
|
901 | return false;
|
902 | }
|
903 | else {
|
904 | errors = _errs58;
|
905 | if(vErrors !== null){
|
906 | if(_errs58){
|
907 | vErrors.length = _errs58;
|
908 | }
|
909 | else {
|
910 | vErrors = null;
|
911 | }
|
912 | }
|
913 | }
|
914 | var valid0 = _errs57 === errors;
|
915 | if(valid0){
|
916 | let data20 = data.requestIdLogLabel;
|
917 | const _errs62 = errors;
|
918 | if(typeof data20 !== "string"){
|
919 | let dataType22 = typeof data20;
|
920 | let coerced22 = undefined;
|
921 | if(!(coerced22 !== undefined)){
|
922 | if(dataType22 == "number" || dataType22 == "boolean"){
|
923 | coerced22 = "" + data20;
|
924 | }
|
925 | else if(data20 === null){
|
926 | coerced22 = "";
|
927 | }
|
928 | else {
|
929 | validate10.errors = [{instancePath:instancePath+"/requestIdLogLabel",schemaPath:"#/properties/requestIdLogLabel/type",keyword:"type",params:{type: "string"},message:"must be string"}];
|
930 | return false;
|
931 | }
|
932 | }
|
933 | if(coerced22 !== undefined){
|
934 | data20 = coerced22;
|
935 | if(data !== undefined){
|
936 | data["requestIdLogLabel"] = coerced22;
|
937 | }
|
938 | }
|
939 | }
|
940 | var valid0 = _errs62 === errors;
|
941 | if(valid0){
|
942 | let data21 = data.http2SessionTimeout;
|
943 | const _errs64 = errors;
|
944 | if(!(((typeof data21 == "number") && (!(data21 % 1) && !isNaN(data21))) && (isFinite(data21)))){
|
945 | let dataType23 = typeof data21;
|
946 | let coerced23 = undefined;
|
947 | if(!(coerced23 !== undefined)){
|
948 | if(dataType23 === "boolean" || data21 === null
|
949 | || (dataType23 === "string" && data21 && data21 == +data21 && !(data21 % 1))){
|
950 | coerced23 = +data21;
|
951 | }
|
952 | else {
|
953 | validate10.errors = [{instancePath:instancePath+"/http2SessionTimeout",schemaPath:"#/properties/http2SessionTimeout/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
|
954 | return false;
|
955 | }
|
956 | }
|
957 | if(coerced23 !== undefined){
|
958 | data21 = coerced23;
|
959 | if(data !== undefined){
|
960 | data["http2SessionTimeout"] = coerced23;
|
961 | }
|
962 | }
|
963 | }
|
964 | var valid0 = _errs64 === errors;
|
965 | if(valid0){
|
966 | let data22 = data.exposeHeadRoutes;
|
967 | const _errs66 = errors;
|
968 | if(typeof data22 !== "boolean"){
|
969 | let coerced24 = undefined;
|
970 | if(!(coerced24 !== undefined)){
|
971 | if(data22 === "false" || data22 === 0 || data22 === null){
|
972 | coerced24 = false;
|
973 | }
|
974 | else if(data22 === "true" || data22 === 1){
|
975 | coerced24 = true;
|
976 | }
|
977 | else {
|
978 | validate10.errors = [{instancePath:instancePath+"/exposeHeadRoutes",schemaPath:"#/properties/exposeHeadRoutes/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
|
979 | return false;
|
980 | }
|
981 | }
|
982 | if(coerced24 !== undefined){
|
983 | data22 = coerced24;
|
984 | if(data !== undefined){
|
985 | data["exposeHeadRoutes"] = coerced24;
|
986 | }
|
987 | }
|
988 | }
|
989 | var valid0 = _errs66 === errors;
|
990 | if(valid0){
|
991 | let data23 = data.useSemicolonDelimiter;
|
992 | const _errs68 = errors;
|
993 | if(typeof data23 !== "boolean"){
|
994 | let coerced25 = undefined;
|
995 | if(!(coerced25 !== undefined)){
|
996 | if(data23 === "false" || data23 === 0 || data23 === null){
|
997 | coerced25 = false;
|
998 | }
|
999 | else if(data23 === "true" || data23 === 1){
|
1000 | coerced25 = true;
|
1001 | }
|
1002 | else {
|
1003 | validate10.errors = [{instancePath:instancePath+"/useSemicolonDelimiter",schemaPath:"#/properties/useSemicolonDelimiter/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];
|
1004 | return false;
|
1005 | }
|
1006 | }
|
1007 | if(coerced25 !== undefined){
|
1008 | data23 = coerced25;
|
1009 | if(data !== undefined){
|
1010 | data["useSemicolonDelimiter"] = coerced25;
|
1011 | }
|
1012 | }
|
1013 | }
|
1014 | var valid0 = _errs68 === errors;
|
1015 | if(valid0){
|
1016 | if(data.versioning !== undefined){
|
1017 | let data24 = data.versioning;
|
1018 | const _errs70 = errors;
|
1019 | if(errors === _errs70){
|
1020 | if(data24 && typeof data24 == "object" && !Array.isArray(data24)){
|
1021 | let missing1;
|
1022 | if(((data24.storage === undefined) && (missing1 = "storage")) || ((data24.deriveVersion === undefined) && (missing1 = "deriveVersion"))){
|
1023 | validate10.errors = [{instancePath:instancePath+"/versioning",schemaPath:"#/properties/versioning/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];
|
1024 | return false;
|
1025 | }
|
1026 | }
|
1027 | else {
|
1028 | validate10.errors = [{instancePath:instancePath+"/versioning",schemaPath:"#/properties/versioning/type",keyword:"type",params:{type: "object"},message:"must be object"}];
|
1029 | return false;
|
1030 | }
|
1031 | }
|
1032 | var valid0 = _errs70 === errors;
|
1033 | }
|
1034 | else {
|
1035 | var valid0 = true;
|
1036 | }
|
1037 | if(valid0){
|
1038 | if(data.constraints !== undefined){
|
1039 | let data25 = data.constraints;
|
1040 | const _errs73 = errors;
|
1041 | if(errors === _errs73){
|
1042 | if(data25 && typeof data25 == "object" && !Array.isArray(data25)){
|
1043 | for(const key2 in data25){
|
1044 | let data26 = data25[key2];
|
1045 | const _errs76 = errors;
|
1046 | if(errors === _errs76){
|
1047 | if(data26 && typeof data26 == "object" && !Array.isArray(data26)){
|
1048 | let missing2;
|
1049 | if(((((data26.name === undefined) && (missing2 = "name")) || ((data26.storage === undefined) && (missing2 = "storage"))) || ((data26.validate === undefined) && (missing2 = "validate"))) || ((data26.deriveConstraint === undefined) && (missing2 = "deriveConstraint"))){
|
1050 | 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+"'"}];
|
1051 | return false;
|
1052 | }
|
1053 | else {
|
1054 | if(data26.name !== undefined){
|
1055 | let data27 = data26.name;
|
1056 | if(typeof data27 !== "string"){
|
1057 | let dataType26 = typeof data27;
|
1058 | let coerced26 = undefined;
|
1059 | if(!(coerced26 !== undefined)){
|
1060 | if(dataType26 == "number" || dataType26 == "boolean"){
|
1061 | coerced26 = "" + data27;
|
1062 | }
|
1063 | else if(data27 === null){
|
1064 | coerced26 = "";
|
1065 | }
|
1066 | else {
|
1067 | 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"}];
|
1068 | return false;
|
1069 | }
|
1070 | }
|
1071 | if(coerced26 !== undefined){
|
1072 | data27 = coerced26;
|
1073 | if(data26 !== undefined){
|
1074 | data26["name"] = coerced26;
|
1075 | }
|
1076 | }
|
1077 | }
|
1078 | }
|
1079 | }
|
1080 | }
|
1081 | else {
|
1082 | 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"}];
|
1083 | return false;
|
1084 | }
|
1085 | }
|
1086 | var valid7 = _errs76 === errors;
|
1087 | if(!valid7){
|
1088 | break;
|
1089 | }
|
1090 | }
|
1091 | }
|
1092 | else {
|
1093 | validate10.errors = [{instancePath:instancePath+"/constraints",schemaPath:"#/properties/constraints/type",keyword:"type",params:{type: "object"},message:"must be object"}];
|
1094 | return false;
|
1095 | }
|
1096 | }
|
1097 | var valid0 = _errs73 === errors;
|
1098 | }
|
1099 | else {
|
1100 | var valid0 = true;
|
1101 | }
|
1102 | }
|
1103 | }
|
1104 | }
|
1105 | }
|
1106 | }
|
1107 | }
|
1108 | }
|
1109 | }
|
1110 | }
|
1111 | }
|
1112 | }
|
1113 | }
|
1114 | }
|
1115 | }
|
1116 | }
|
1117 | }
|
1118 | }
|
1119 | }
|
1120 | }
|
1121 | }
|
1122 | }
|
1123 | }
|
1124 | }
|
1125 | }
|
1126 | }
|
1127 | }
|
1128 | else {
|
1129 | validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];
|
1130 | return false;
|
1131 | }
|
1132 | }
|
1133 | validate10.errors = vErrors;
|
1134 | return errors === 0;
|
1135 | }
|
1136 |
|
1137 |
|
1138 | module.exports.defaultInitOptions = {"connectionTimeout":0,"keepAliveTimeout":72000,"maxRequestsPerSocket":0,"requestTimeout":0,"bodyLimit":1048576,"caseSensitive":true,"allowUnsafeRegex":false,"disableRequestLogging":false,"jsonShorthand":true,"ignoreTrailingSlash":false,"ignoreDuplicateSlashes":false,"maxParamLength":100,"onProtoPoisoning":"error","onConstructorPoisoning":"error","pluginTimeout":10000,"requestIdHeader":"request-id","requestIdLogLabel":"reqId","http2SessionTimeout":72000,"exposeHeadRoutes":true,"useSemicolonDelimiter":true}
|