
playground.server.pages.js.tv4.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gateleen-playground Show documentation
Show all versions of gateleen-playground Show documentation
Middleware library based on Vert.x to build advanced JSON/REST communication servers
!function(a){"use strict";function b(a,c){if(a===c)return!0;if("object"==typeof a&&"object"==typeof c){if(Array.isArray(a)!==Array.isArray(c))return!1;if(Array.isArray(a)){if(a.length!==c.length)return!1;for(var d=0;d0&&"/"===b.charAt(a.length-1)||"#"===c.charAt(0)||"?"===c.charAt(0))return!0}return!1}function i(a){var b=new j,c=a||"en",g={addFormat:function(){b.addFormat.apply(b,arguments)},language:function(a){return a?(m[a]||(a=a.split("-")[0]),m[a]?(c=a,a):!1):c},addLanguage:function(a,b){var c;for(c in k)b[c]&&!b[k[c]]&&(b[k[c]]=b[c]);var d=a.split("-")[0];if(m[d]){m[a]=Object.create(m[d]);for(c in b)"undefined"==typeof m[d][c]&&(m[d][c]=b[c]),m[a][c]=b[c]}else m[a]=b,m[d]=b;return this},freshApi:function(a){var b=i();return a&&b.language(a),b},validate:function(a,d,e,f){var g=new j(b,!1,m[c],e,f);"string"==typeof d&&(d={$ref:d}),g.addSchema("",d);var h=g.validateAll(a,d,null,null,"");return!h&&f&&(h=g.banUnknownProperties()),this.error=h,this.missing=g.missing,this.valid=null===h,this.valid},validateResult:function(){var a={};return this.validate.apply(a,arguments),a},validateMultiple:function(a,d,e,f){var g=new j(b,!0,m[c],e,f);"string"==typeof d&&(d={$ref:d}),g.addSchema("",d),g.validateAll(a,d,null,null,""),f&&g.banUnknownProperties();var h={};return h.errors=g.errors,h.missing=g.missing,h.valid=0===h.errors.length,h},addSchema:function(){return b.addSchema.apply(b,arguments)},getSchema:function(){return b.getSchema.apply(b,arguments)},getSchemaMap:function(){return b.getSchemaMap.apply(b,arguments)},getSchemaUris:function(){return b.getSchemaUris.apply(b,arguments)},getMissingUris:function(){return b.getMissingUris.apply(b,arguments)},dropSchemas:function(){b.dropSchemas.apply(b,arguments)},reset:function(){b.reset(),this.error=null,this.missing=[],this.valid=!0},missing:[],error:null,valid:!0,normSchema:f,resolveUrl:d,getDocumentUri:e,errorCodes:k};return g}Object.keys||(Object.keys=function(){var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=c.length;return function(e){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError("Object.keys called on non-object");var f=[];for(var g in e)a.call(e,g)&&f.push(g);if(b)for(var h=0;d>h;h++)a.call(e,c[h])&&f.push(c[h]);return f}}()),Object.create||(Object.create=function(){function a(){}return function(b){if(1!==arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return a.prototype=b,new a}}()),Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){if(null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&1/0!==d&&d!==-1/0&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),Object.isFrozen||(Object.isFrozen=function(a){for(var b="tv4_test_frozen_key";a.hasOwnProperty(b);)b+=Math.random();try{return a[b]=!0,delete a[b],!1}catch(c){return!0}});var j=function(a,b,c,d,e){this.missing=[],this.missingMap={},this.formatValidators=a?Object.create(a.formatValidators):{},this.schemas=a?Object.create(a.schemas):{},this.collectMultiple=b,this.errors=[],this.handleError=b?this.collectError:this.returnError,d&&(this.checkRecursive=!0,this.scanned=[],this.scannedFrozen=[],this.scannedFrozenSchemas=[],this.scannedFrozenValidationErrors=[],this.validatedSchemasKey="tv4_validation_id",this.validationErrorsKey="tv4_validation_errors_id"),e&&(this.trackUnknownProperties=!0,this.knownPropertyPaths={},this.unknownPropertyPaths={}),this.errorMessages=c};j.prototype.createError=function(a,b,c,d,e){var f=this.errorMessages[a]||l[a];if("string"!=typeof f)return new g(a,"Unknown error code "+a+": "+JSON.stringify(b),c,d,e);var h=f.replace(/\{([^{}]*)\}/g,function(a,c){var d=b[c];return"string"==typeof d||"number"==typeof d?d:a});return new g(a,h,c,d,e)},j.prototype.returnError=function(a){return a},j.prototype.collectError=function(a){return a&&this.errors.push(a),null},j.prototype.prefixErrors=function(a,b,c){for(var d=a;db.maximum)return this.createError(k.NUMBER_MAXIMUM,{value:a,maximum:b.maximum}).prefixWith(null,"maximum");if(b.exclusiveMaximum&&a===b.maximum)return this.createError(k.NUMBER_MAXIMUM_EXCLUSIVE,{value:a,maximum:b.maximum}).prefixWith(null,"exclusiveMaximum")}return null},j.prototype.validateString=function(a,b,c){return this.validateStringLength(a,b,c)||this.validateStringPattern(a,b,c)||null},j.prototype.validateStringLength=function(a,b){return"string"!=typeof a?null:void 0!==b.minLength&&a.lengthb.maxLength?this.createError(k.STRING_LENGTH_LONG,{length:a.length,maximum:b.maxLength}).prefixWith(null,"maxLength"):null},j.prototype.validateStringPattern=function(a,b){if("string"!=typeof a||void 0===b.pattern)return null;var c=new RegExp(b.pattern);return c.test(a)?null:this.createError(k.STRING_PATTERN,{pattern:b.pattern}).prefixWith(null,"pattern")},j.prototype.validateArray=function(a,b,c){return Array.isArray(a)?this.validateArrayLength(a,b,c)||this.validateArrayUniqueItems(a,b,c)||this.validateArrayItems(a,b,c)||null:null},j.prototype.validateArrayLength=function(a,b){var c;return void 0!==b.minItems&&a.lengthb.maxItems&&(c=this.createError(k.ARRAY_LENGTH_LONG,{length:a.length,maximum:b.maxItems}).prefixWith(null,"maxItems"),this.handleError(c))?c:null},j.prototype.validateArrayUniqueItems=function(a,c){if(c.uniqueItems)for(var d=0;db.maxProperties&&(c=this.createError(k.OBJECT_PROPERTIES_MAXIMUM,{propertyCount:d.length,maximum:b.maxProperties}).prefixWith(null,"maxProperties"),this.handleError(c))?c:null},j.prototype.validateObjectRequiredProperties=function(a,b){if(void 0!==b.required)for(var c=0;c
© 2015 - 2025 Weber Informatics LLC | Privacy Policy