/** * GET /api/v1/schema/trueref-config.json * * Returns the JSON Schema for the trueref.json repository configuration file. * IDE tooling (VS Code, JetBrains, etc.) can reference this URL in the * `$schema` field of a trueref.json file to get autocomplete and validation. * * Example trueref.json with schema reference: * { * "$schema": "http://localhost:5173/api/v1/schema/trueref-config.json", * "projectTitle": "My Library", * "rules": ["Always use named imports"] * } */ import type { RequestHandler } from './$types'; import schema from '$lib/server/config/trueref-config.json' assert { type: 'json' }; import { CORS_HEADERS } from '$lib/server/api/formatters'; export const GET: RequestHandler = () => { return new Response(JSON.stringify(schema, null, 2), { status: 200, headers: { 'Content-Type': 'application/schema+json', 'Cache-Control': 'public, max-age=3600', ...CORS_HEADERS } }); }; export const OPTIONS: RequestHandler = () => { return new Response(null, { status: 204, headers: CORS_HEADERS }); };