feat: initial commit

This commit is contained in:
2026-06-29 23:07:14 +00:00
commit 3b9a6bc85c
152 changed files with 12558 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import KoaRouter from "@koa/router";
import * as validators from "../schema/validators.js";
export function schemarouter(): KoaRouter {
const router = new KoaRouter();
router.get("/", (ctx) => {
ctx.body = Object.fromEntries(
Object.entries(validators).map(([name, { schema }]) => {
return [
name,
{
$id: schema.$id,
title: schema.title,
description: schema.description,
url: `${ctx.URL}/${name}.schema.json`,
},
];
})
);
});
for (const [name, { schema }] of Object.entries(validators)) {
router.get(`/${name}.schema.json`, (ctx) => {
ctx.body = schema;
});
}
return router;
}