UNPKG

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