Skip to content

Commit e8d2d04

Browse files
committed
refactor(api): remove unused interface and simplify parameter handling in GET request for schema retrieval
1 parent b155186 commit e8d2d04

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

app/api/get-schema/[name]/route.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { NextResponse, NextRequest } from "next/server";
22
import fs from "fs/promises";
33
import path from "path";
44

5-
// Explicitly define the type for the context parameter
6-
interface RouteContext {
7-
params: {
8-
name: string;
9-
};
10-
}
5+
// Remove unused interface definition
6+
// interface RouteContext {
7+
// params: {
8+
// name: string;
9+
// };
10+
// }
1111

1212
// Helper function to safely join paths and prevent traversal
1313
function safeJoin(base: string, target: string): string | null {
@@ -20,12 +20,12 @@ function safeJoin(base: string, target: string): string | null {
2020
return null; // Path traversal detected or invalid path
2121
}
2222

23-
2423
export async function GET(
25-
request: NextRequest,
26-
context: RouteContext // Use the explicitly defined type
24+
// Remove the request parameter as it's unused
25+
// request: NextRequest,
26+
{ params }: { params: { name: string } } // Use standard destructuring for the context/params
2727
) {
28-
const schemaName = context.params.name;
28+
const schemaName = params.name; // Access name via params
2929

3030
if (!schemaName) {
3131
return NextResponse.json({ error: "Schema name required" }, { status: 400 });

0 commit comments

Comments
 (0)