Update gen-spec.ts

This commit is contained in:
syuilo 2024-08-16 14:55:08 +09:00
parent 2e24e2e5ae
commit 8e2cf2853c
1 changed files with 8 additions and 3 deletions

View File

@ -92,7 +92,6 @@ export function genOpenapiSpec(config: Config, includeSelfRef = false) {
const hasBody = (schema.type === 'object' && schema.properties && Object.keys(schema.properties).length >= 1);
const info = {
operationId: endpoint.name.replaceAll('/', '___'), // NOTE: スラッシュは使えない
summary: endpoint.name,
description: desc,
externalDocs: {
@ -210,9 +209,15 @@ export function genOpenapiSpec(config: Config, includeSelfRef = false) {
spec.paths['/' + endpoint.name] = {
...(endpoint.meta.allowGet ? {
get: info,
get: {
...info,
operationId: 'get_____' + endpoint.name.replaceAll('/', '___'), // NOTE: スラッシュは使えない
},
} : {}),
post: info,
post: {
...info,
operationId: 'post_____' + endpoint.name.replaceAll('/', '___'), // NOTE: スラッシュは使えない
},
};
}