mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-02 00:36:38 +00:00
add openapi registers
This commit is contained in:
@@ -8,6 +8,7 @@ import HttpCode from "@server/types/HttpCode";
|
||||
import createHttpError from "http-errors";
|
||||
import { fromError } from "zod-validation-error";
|
||||
import logger from "@server/logger";
|
||||
import { OpenAPITags, registry } from "@server/openApi";
|
||||
|
||||
const getResourceSchema = z
|
||||
.object({
|
||||
@@ -22,6 +23,17 @@ export type GetResourceResponse = Resource & {
|
||||
siteName: string;
|
||||
};
|
||||
|
||||
registry.registerPath({
|
||||
method: "get",
|
||||
path: "/resource/{resourceId}",
|
||||
description: "Get a resource.",
|
||||
tags: [OpenAPITags.Resource],
|
||||
request: {
|
||||
params: getResourceSchema
|
||||
},
|
||||
responses: {}
|
||||
});
|
||||
|
||||
export async function getResource(
|
||||
req: Request,
|
||||
res: Response,
|
||||
|
||||
Reference in New Issue
Block a user