(/** @type {SchemaFile} */ schema)
| 1851 | } |
| 1852 | |
| 1853 | async 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 | |
| 1879 | async function assertTopLevelRefIsStandalone(/** @type {SchemaFile} */ schema) { |
| 1880 | if (schema.json.$ref?.startsWith('http')) { |
nothing calls this directly
no test coverage detected