mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-03 17:44:44 +02:00
add openapi registers
This commit is contained in:
parent
a76e3e00f7
commit
d260450a84
50 changed files with 852 additions and 60 deletions
|
@ -17,6 +17,8 @@ import logger from "@server/logger";
|
|||
import { fromError } from "zod-validation-error";
|
||||
import config from "@server/lib/config";
|
||||
import { subdomainSchema } from "@server/lib/schemas";
|
||||
import { registry } from "@server/openApi";
|
||||
import { OpenAPITags } from "@server/openApi";
|
||||
|
||||
const updateResourceParamsSchema = z
|
||||
.object({
|
||||
|
@ -93,6 +95,26 @@ const updateRawResourceBodySchema = z
|
|||
{ message: "Cannot update proxyPort" }
|
||||
);
|
||||
|
||||
registry.registerPath({
|
||||
method: "post",
|
||||
path: "/resource/{resourceId}",
|
||||
description: "Update a resource.",
|
||||
tags: [OpenAPITags.Resource],
|
||||
request: {
|
||||
params: updateResourceParamsSchema,
|
||||
body: {
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: updateHttpResourceBodySchema.and(
|
||||
updateRawResourceBodySchema
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {}
|
||||
});
|
||||
|
||||
export async function updateResource(
|
||||
req: Request,
|
||||
res: Response,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue