MCPcopy Create free account
hub / github.com/SchemaStore/schemastore / parseSchemaFormat

Function parseSchemaFormat

scripts/build-xregistry.js:119–125  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

117 * @returns {string} - The schema format (e.g., JsonSchema/draft-07).
118 */
119function 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

Callers 1

getSchemaFormatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected