Sha256: 369c8483c283ac607dbd0cbc67d2191982511415a25ded1fffbded9b089ff9c2

Contents?: true

Size: 1.51 KB

Versions: 123

Compression:

Stored size: 1.51 KB

Contents

{{# def.definitions }}
{{# def.errors }}
{{# def.setupKeyword }}
{{# def.setupNextLevel }}


{{## def.validateIf:
  {{# def.setCompositeRule }}
  {{ $it.createErrors = false; }}
  {{# def._validateSwitchRule:if }}
  {{ $it.createErrors = true; }}
  {{# def.resetCompositeRule }}
  {{=$ifPassed}} = {{=$nextValid}};
#}}

{{## def.validateThen:
  {{? typeof $sch.then == 'boolean' }}
    {{? $sch.then === false }}
      {{# def.error:'switch' }}
    {{?}}
    var {{=$nextValid}} = {{= $sch.then }};
  {{??}}
    {{# def._validateSwitchRule:then }}
  {{?}}
#}}

{{## def._validateSwitchRule:_clause:
  {{
    $it.schema = $sch._clause;
    $it.schemaPath = $schemaPath + '[' + $caseIndex + ']._clause';
    $it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/_clause';
  }}
  {{# def.insertSubschemaCode }}
#}}

{{## def.switchCase:
  {{? $sch.if && {{# def.nonEmptySchema:$sch.if }} }}
    var {{=$errs}} = errors;
    {{# def.validateIf }}
    if ({{=$ifPassed}}) {
      {{# def.validateThen }}  
    } else {
      {{# def.resetErrors }}
    }
  {{??}}
    {{=$ifPassed}} = true;
    {{# def.validateThen }}
  {{?}}
#}}


{{
  var $ifPassed = 'ifPassed' + it.level
    , $currentBaseId = $it.baseId
    , $shouldContinue;
}}
var {{=$ifPassed}};

{{~ $schema:$sch:$caseIndex }}
  {{? $caseIndex && !$shouldContinue }}
    if (!{{=$ifPassed}}) {
    {{ $closingBraces+= '}'; }}
  {{?}}

  {{# def.switchCase }}
  {{ $shouldContinue = $sch.continue }}
{{~}}

{{= $closingBraces }}

var {{=$valid}} = {{=$nextValid}};

{{# def.cleanUp }}

Version data entries

123 entries across 73 versions & 13 rubygems

Version Path
disco_app-0.18.0 test/dummy/node_modules/ajv-keywords/keywords/dot/switch.jst
disco_app-0.18.2 test/dummy/node_modules/ajv-keywords/keywords/dot/switch.jst
disco_app-0.16.1 test/dummy/node_modules/ajv-keywords/keywords/dot/switch.jst
disco_app-0.15.2 test/dummy/node_modules/ajv-keywords/keywords/dot/switch.jst
disco_app-0.18.4 test/dummy/node_modules/ajv-keywords/keywords/dot/switch.jst
disco_app-0.18.1 test/dummy/node_modules/ajv-keywords/keywords/dot/switch.jst
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/ajv-keywords/keywords/dot/switch.jst
disco_app-0.14.0 test/dummy/node_modules/ajv-keywords/keywords/dot/switch.jst
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/ajv-keywords/keywords/dot/switch.jst
enju_library-0.3.8 spec/dummy/node_modules/ajv-keywords/keywords/dot/switch.jst
ilog-0.4.1 node_modules/ajv/lib/dot/v5/switch.jst
ilog-0.4.0 node_modules/ajv/lib/dot/v5/switch.jst
ilog-0.3.3 node_modules/ajv/lib/dot/v5/switch.jst
jester-data-8.0.0 node_modules/ajv-keywords/keywords/dot/switch.jst
ezii-os-5.2.1 node_modules/ajv-keywords/keywords/dot/switch.jst
ezii-os-2.0.1 node_modules/ajv-keywords/keywords/dot/switch.jst
ezii-os-1.1.0 node_modules/ajv-keywords/keywords/dot/switch.jst
ezii-os-1.0.0 node_modules/ajv-keywords/keywords/dot/switch.jst
ezii-os-0.0.0.1.0 node_modules/ajv-keywords/keywords/dot/switch.jst
ezii-os-0.0.0.0.1 node_modules/ajv-keywords/keywords/dot/switch.jst