mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-02 21:51:23 +00:00
add openapi registers
This commit is contained in:
parent
a76e3e00f7
commit
d260450a84
50 changed files with 852 additions and 60 deletions
|
|
@ -13,6 +13,7 @@ import {
|
|||
isValidIP,
|
||||
isValidUrlGlobPattern
|
||||
} from "@server/lib/validators";
|
||||
import { OpenAPITags, registry } from "@server/openApi";
|
||||
|
||||
// Define Zod schema for request parameters validation
|
||||
const updateResourceRuleParamsSchema = z
|
||||
|
|
@ -39,6 +40,24 @@ const updateResourceRuleSchema = z
|
|||
message: "At least one field must be provided for update"
|
||||
});
|
||||
|
||||
registry.registerPath({
|
||||
method: "post",
|
||||
path: "/resource/{resourceId}/rule/{ruleId}",
|
||||
description: "Update a resource rule.",
|
||||
tags: [OpenAPITags.Resource, OpenAPITags.Rule],
|
||||
request: {
|
||||
params: updateResourceRuleParamsSchema,
|
||||
body: {
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: updateResourceRuleSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {}
|
||||
});
|
||||
|
||||
export async function updateResourceRule(
|
||||
req: Request,
|
||||
res: Response,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue