(schemaPath: string)
| 112 | } |
| 113 | |
| 114 | async function readSchemaFromSingleFile(schemaPath: string): Promise<LookupResult> { |
| 115 | debug('Reading schema from single file', schemaPath) |
| 116 | |
| 117 | const typeError = await ensureType(schemaPath, 'file') |
| 118 | if (typeError) { |
| 119 | return { ok: false, error: typeError } |
| 120 | } |
| 121 | const file = await readFile(schemaPath, { encoding: 'utf-8' }) |
| 122 | const schemaTuple: MultipleSchemaTuple = [schemaPath, file] |
| 123 | return { |
| 124 | ok: true, |
| 125 | schema: { schemaPath, schemaRootDir: path.dirname(schemaPath), schemas: [schemaTuple] }, |
| 126 | } as const |
| 127 | } |
| 128 | |
| 129 | async function readSchemaFromDirectory(schemaPath: string): Promise<LookupResult> { |
| 130 | debug('Reading schema from multiple files', schemaPath) |
no test coverage detected