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

Function assertSchemaNoSmartQuotes

cli.js:1853–1877  ·  view source on GitHub ↗
(/** @type {SchemaFile} */ schema)

Source from the content-addressed store, hash-verified

1851}
1852
1853async function assertSchemaNoSmartQuotes(/** @type {SchemaFile} */ schema) {
1854 const buffer = schema.buffer
1855 const bufferArr = buffer.toString().split('\n')
1856
1857 for (let i = 0; i < bufferArr.length; ++i) {
1858 const line = bufferArr[i]
1859
1860 if (/"(?:description|title)": ".*?:"/.test(line)) {
1861 printErrorAndExit(new Error(), [
1862 `Do not expect "description" or "title" to end with a colon`,
1863 `Failed to successfully validate file "${schema.path}:${i + 1}"`,
1864 ])
1865 }
1866
1867 // const smartQuotes = ['‘', '’', '“', '”']
1868 // for (const quote of smartQuotes) {
1869 // if (line.includes(quote)) {
1870 // printErrorAndExit(new Error(), [
1871 // `Expected file to have no smart quotes`,
1872 // `Found smart quotes in file "./${schema.path}:${++i}"`,
1873 // ])
1874 // }
1875 // }
1876 }
1877}
1878
1879async function assertTopLevelRefIsStandalone(/** @type {SchemaFile} */ schema) {
1880 if (schema.json.$ref?.startsWith('http')) {

Callers

nothing calls this directly

Calls 1

printErrorAndExitFunction · 0.85

Tested by

no test coverage detected