MCPcopy Index your code
hub / github.com/SchemaStore/schemastore / onSchemaFile

Function onSchemaFile

cli.js:633–663  ·  view source on GitHub ↗
(schema)

Source from the content-addressed store, hash-verified

631 await forEachFile({
632 actionName: 'lint',
633 async onSchemaFile(schema) {
634 // This checks to be sure $id is a schemastore.org URL.
635 // Commenting out because it is overly aggressive for now.
636 // await assertSchemaHasCorrectMetadata(schema)
637 await assertTopLevelRefIsStandalone(schema)
638 // await assertSchemaNoSmartQuotes(schema)
639
640 try {
641 const errors = schemasafe.lint(schema.json, {
642 // mode: 'strong',
643 requireSchema: true,
644 requireValidation: true,
645 requireStringValidation: false,
646 complexityChecks: true,
647 forbidNoopValues: true,
648
649 extraFormats: false,
650 schemas: {},
651 })
652 for (const err of errors) {
653 console.log(`${schema.name}: ${err.message}`)
654 }
655 entries.push({
656 count: errors.length,
657 file: schema.name,
658 })
659 } catch (err) {
660 console.log(err)
661 return
662 }
663 },
664 })
665
666 entries.sort((a, b) => a.count - b.count)

Callers

nothing calls this directly

Calls 11

assertFileHasNoBomFunction · 0.85
assertFilePassesJsonLintFunction · 0.85
getSchemaDialectFunction · 0.85
getSchemaOptionsFunction · 0.85
ajvFactoryFunction · 0.85
printErrorAndExitFunction · 0.85

Tested by

no test coverage detected