bodyが無い(空オブジェクト)のときはrequestBodyを描画しないようにする
This commit is contained in:
@@ -85,6 +85,8 @@ export function genOpenapiSpec(config: Config) {
|
|||||||
schema.required = undefined;
|
schema.required = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hasBody = (schema.type === 'object' && schema.properties && Object.keys(schema.properties).length >= 1);
|
||||||
|
|
||||||
const info = {
|
const info = {
|
||||||
operationId: endpoint.name,
|
operationId: endpoint.name,
|
||||||
summary: endpoint.name,
|
summary: endpoint.name,
|
||||||
@@ -101,14 +103,16 @@ export function genOpenapiSpec(config: Config) {
|
|||||||
bearerAuth: [],
|
bearerAuth: [],
|
||||||
}],
|
}],
|
||||||
} : {}),
|
} : {}),
|
||||||
requestBody: {
|
...(hasBody ? {
|
||||||
required: true,
|
requestBody: {
|
||||||
content: {
|
required: true,
|
||||||
[requestType]: {
|
content: {
|
||||||
schema,
|
[requestType]: {
|
||||||
|
schema,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
} : {}),
|
||||||
responses: {
|
responses: {
|
||||||
...(endpoint.meta.res ? {
|
...(endpoint.meta.res ? {
|
||||||
'200': {
|
'200': {
|
||||||
|
|||||||
Reference in New Issue
Block a user