Skip to content

Commit

Permalink
Update gen-spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed Aug 16, 2024
1 parent 2e24e2e commit 8e2cf28
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/backend/src/server/api/openapi/gen-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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: スラッシュは使えない
},
};
}

Expand Down

0 comments on commit 8e2cf28

Please sign in to comment.