(invocation: QueryInvocation, tables: TableSchema[])
| 180 | } |
| 181 | |
| 182 | function validateQueryInvocation(invocation: QueryInvocation, tables: TableSchema[]) { |
| 183 | if ( |
| 184 | !invocation.resultTypeAssertion || |
| 185 | invocation.query.returnedColumns.some(isUnresolvableColumnReference) |
| 186 | ) { |
| 187 | return |
| 188 | } |
| 189 | |
| 190 | try { |
| 191 | const resultTypeAssertion = invocation.resultTypeAssertion |
| 192 | const resultSchema = resolveColumnRefsToTableSchemaDescriptor( |
| 193 | invocation.query.returnedColumns, |
| 194 | tables |
| 195 | ) |
| 196 | validateQueryMatchesReturnType( |
| 197 | resultSchema, |
| 198 | resultTypeAssertion.schema, |
| 199 | resultTypeAssertion.path, |
| 200 | invocation.query |
| 201 | ) |
| 202 | } catch (error) { |
| 203 | throw augmentFileValidationError(error, invocation.query) |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | export function validateQuery(invocation: QueryInvocation, tables: TableSchema[]) { |
| 208 | const tableExpressions: TableSchema[] = getAllSubqueries(invocation.query) |
no test coverage detected