MCPcopy Index your code
hub / github.com/json-editor/json-editor / validateMapping

Function validateMapping

docs/scripts/ajv-validator.js:5796–5806  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5794 gen.if((0, codegen_1._) `typeof ${tag} == "string"`, () => validateMapping(), () => cxt.error(false, { discrError: types_1.DiscrError.Tag, tag, tagName }));
5795 cxt.ok(valid);
5796 function validateMapping() {
5797 const mapping = getMapping();
5798 gen.if(false);
5799 for (const tagValue in mapping) {
5800 gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`);
5801 gen.assign(valid, applyTagSchema(mapping[tagValue]));
5802 }
5803 gen.else();
5804 cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag, tagName });
5805 gen.endIf();
5806 }
5807 function applyTagSchema(schemaProp) {
5808 const _valid = gen.name("valid");
5809 const schCxt = cxt.subschema({ keyword: "oneOf", schemaProp }, _valid);

Callers 1

codeFunction · 0.85

Calls 8

getMappingFunction · 0.85
applyTagSchemaFunction · 0.85
elseIfMethod · 0.80
assignMethod · 0.80
elseMethod · 0.80
errorMethod · 0.80
endIfMethod · 0.80
ifMethod · 0.45

Tested by

no test coverage detected