(
/** @type {SchemaFile} */ schema,
)
| 1745 | } |
| 1746 | |
| 1747 | async function assertSchemaHasValidSchemaField( |
| 1748 | /** @type {SchemaFile} */ schema, |
| 1749 | ) { |
| 1750 | const schemaDialectUrls = SchemaDialects.map( |
| 1751 | (schemaDialect) => schemaDialect.url, |
| 1752 | ) |
| 1753 | if (!schemaDialectUrls.includes(schema.json.$schema)) { |
| 1754 | printErrorAndExit(new Error(), [ |
| 1755 | `Invalid or missing '$schema' keyword in schema file "${schema.name}"`, |
| 1756 | `Valid schemas: ${JSON.stringify(schemaDialectUrls)}`, |
| 1757 | ]) |
| 1758 | } |
| 1759 | |
| 1760 | if (!SchemaValidation.highSchemaVersion.includes(schema.name)) { |
| 1761 | const tooHighSchemas = SchemaDialects.filter( |
| 1762 | (schemaDialect) => schemaDialect.isTooHigh, |
| 1763 | ).map((schemaDialect) => schemaDialect.url) |
| 1764 | if (tooHighSchemas.includes(schema.json.$schema)) { |
| 1765 | printErrorAndExit(new Error(), [ |
| 1766 | `Found a too high schema version in file "./${schema.path}"`, |
| 1767 | `Schema version "${schema.json.$schema}" is not supported by many editors and IDEs`, |
| 1768 | `We recommend using a lower schema version.`, |
| 1769 | `To ignore this error, append to the "highSchemaVersion" key in "${SchemaValidationFile}"`, |
| 1770 | ]) |
| 1771 | } |
| 1772 | } |
| 1773 | } |
| 1774 | |
| 1775 | async function assertSchemaHasValidIdField(/** @type {SchemaFile} */ schema) { |
| 1776 | let schemaId = '' |
no test coverage detected