File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
vscode/extension/src/utilities Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -6,10 +6,12 @@ import { traceVerbose, traceInfo } from './common/log'
66import { parse } from 'shell-quote'
77import { z } from 'zod'
88
9- export interface SqlmeshConfiguration {
10- projectPath : string
11- lspEntryPoint : string
12- }
9+ const configSchema = z . object ( {
10+ projectPath : z . string ( ) ,
11+ lspEntryPoint : z . string ( ) ,
12+ } )
13+
14+ export type SqlmeshConfiguration = z . infer < typeof configSchema >
1315
1416/**
1517 * Get the SQLMesh configuration from VS Code settings.
@@ -20,10 +22,17 @@ function getSqlmeshConfiguration(): SqlmeshConfiguration {
2022 const config = workspace . getConfiguration ( 'sqlmesh' )
2123 const projectPath = config . get < string > ( 'projectPath' , '' )
2224 const lspEntryPoint = config . get < string > ( 'lspEntrypoint' , '' )
23- return {
25+
26+ const parsed = configSchema . safeParse ( {
2427 projectPath,
2528 lspEntryPoint,
29+ } )
30+ if ( ! parsed . success ) {
31+ throw new Error (
32+ `Invalid sqlmesh configuration: ${ JSON . stringify ( parsed . error ) } ` ,
33+ )
2634 }
35+ return parsed . data
2736}
2837
2938const stringsArray = z . array ( z . string ( ) )
You can’t perform that action at this time.
0 commit comments