File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
app/api/get-schema/[name] Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -46,8 +46,13 @@ export async function GET(
4646 console . log ( `Attempting to read schema file: ${ filePath } ` ) ;
4747
4848 const fileContent : string = await fs . readFile ( filePath , "utf-8" ) ;
49- // Parse JSON with proper type assertion
50- const schemaJson : Record < string , unknown > = JSON . parse ( fileContent ) ;
49+ // Parse JSON with proper type assertion that satisfies ESLint
50+ const parsedContent = JSON . parse ( fileContent ) ;
51+ // Use type assertion after validation to satisfy ESLint
52+ const schemaJson : Record < string , unknown > =
53+ typeof parsedContent === 'object' && parsedContent !== null
54+ ? parsedContent as Record < string , unknown >
55+ : { } ;
5156
5257 return NextResponse . json ( schemaJson ) ;
5358 } catch ( error : unknown ) {
You can’t perform that action at this time.
0 commit comments