@kubernetes-models/keda
Version:
KEDA(Kubernetes Event-driven Autoscaling) models
1 lines • 2.89 kB
JavaScript
import{formats}from"@kubernetes-models/validate";export const validate=validate1;let schema2_enum=["static","currentReplicas","currentReplicasIfHigher","currentReplicasIfLower"];function validate2(data,{instancePath="",parentData,parentDataProperty,rootData=data}={}){let vErrors=null,errors=0;if("string"!=typeof data&&null!==data){let err0={instancePath,schemaPath:"#/type",keyword:"type",params:{type:"string"}};null===vErrors?vErrors=[err0]:vErrors.push(err0),errors++}if("static"!==data&&"currentReplicas"!==data&&"currentReplicasIfHigher"!==data&&"currentReplicasIfLower"!==data){let err1={instancePath,schemaPath:"#/enum",keyword:"enum",params:{allowedValues:schema2_enum}};null===vErrors?vErrors=[err1]:vErrors.push(err1),errors++}return validate2.errors=vErrors,0===errors}let formats0=formats.int32;function validate0(data,{instancePath="",parentData,parentDataProperty,rootData=data}={}){let vErrors=null,errors=0;if(!("number"==typeof data&&!(data%1)&&!isNaN(data)&&isFinite(data))){let err0={instancePath,schemaPath:"#/type",keyword:"type",params:{type:"integer"}};null===vErrors?vErrors=[err0]:vErrors.push(err0),errors++}if("number"==typeof data&&isFinite(data)&&!formats0.validate(data)){let err1={instancePath,schemaPath:"#/format",keyword:"format",params:{format:"int32"}};null===vErrors?vErrors=[err1]:vErrors.push(err1),errors++}return validate0.errors=vErrors,0===errors}function validate1(data,{instancePath="",parentData,parentDataProperty,rootData=data}={}){let vErrors=null,errors=0;if(data&&"object"==typeof data&&!Array.isArray(data)){if(void 0===data.failureThreshold){let err0={instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty:"failureThreshold"}};null===vErrors?vErrors=[err0]:vErrors.push(err0),errors++}if(void 0===data.replicas){let err1={instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty:"replicas"}};null===vErrors?vErrors=[err1]:vErrors.push(err1),errors++}void 0!==data.behavior&&(validate2(data.behavior,{instancePath:instancePath+"/behavior",parentData:data,parentDataProperty:"behavior",rootData})||(errors=(vErrors=null===vErrors?validate2.errors:vErrors.concat(validate2.errors)).length)),void 0!==data.failureThreshold&&(validate0(data.failureThreshold,{instancePath:instancePath+"/failureThreshold",parentData:data,parentDataProperty:"failureThreshold",rootData})||(errors=(vErrors=null===vErrors?validate0.errors:vErrors.concat(validate0.errors)).length)),void 0!==data.replicas&&(validate0(data.replicas,{instancePath:instancePath+"/replicas",parentData:data,parentDataProperty:"replicas",rootData})||(errors=(vErrors=null===vErrors?validate0.errors:vErrors.concat(validate0.errors)).length))}else{let err2={instancePath,schemaPath:"#/type",keyword:"type",params:{type:"object"}};null===vErrors?vErrors=[err2]:vErrors.push(err2),errors++}return validate1.errors=vErrors,0===errors}