MCPcopy Create free account
hub / github.com/json-editor/json-editor / commentKeyword

Function commentKeyword

docs/scripts/ajv-validator.js:2911–2921  ·  view source on GitHub ↗
({ gen, schemaEnv, schema, errSchemaPath, opts })

Source from the content-addressed store, hash-verified

2909 throw new Error("async schema in sync schema");
2910 }
2911 function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) {
2912 const msg = schema.$comment;
2913 if (opts.$comment === true) {
2914 gen.code((0, codegen_1._) `${names_1.default.self}.logger.log(${msg})`);
2915 }
2916 else if (typeof opts.$comment == "function") {
2917 const schemaPath = (0, codegen_1.str) `${errSchemaPath}/$comment`;
2918 const rootName = gen.scopeValue("root", { ref: schemaEnv.root });
2919 gen.code((0, codegen_1._) `${names_1.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`);
2920 }
2921 }
2922 function returnResults(it) {
2923 const { gen, schemaEnv, validateName, ValidationError, opts } = it;
2924 if (schemaEnv.$async) {

Callers 2

topSchemaObjCodeFunction · 0.85
subSchemaObjCodeFunction · 0.85

Calls 2

codeMethod · 0.80
scopeValueMethod · 0.80

Tested by

no test coverage detected