* Parses a $schema URI into a format string. * @param {string} schemaUri - The $schema value. * @returns {string} - The schema format (e.g., JsonSchema/draft-07).
(schemaUri)
| 117 | * @returns {string} - The schema format (e.g., JsonSchema/draft-07). |
| 118 | */ |
| 119 | function parseSchemaFormat(schemaUri) { |
| 120 | const draftMatch = /draft-(\d+)[-\w]*/i.exec(schemaUri) |
| 121 | if (draftMatch) { |
| 122 | return `JsonSchema/draft-${draftMatch[1]}` |
| 123 | } |
| 124 | return 'JsonSchema' |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Determines the schema format for a local schemastore.org schema by reading |