diff options
| author | Johann150 <johann.galle@protonmail.com> | 2022-05-27 15:03:25 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-27 22:03:25 +0900 |
| commit | 63a814c70e96a5d39738e4157b4e94fb29c93f2e (patch) | |
| tree | 5c0c1bd429a6c50ff76cc9ce28ea446ec2bb3b26 | |
| parent | fix lints (#8737) (diff) | |
| download | sharkey-63a814c70e96a5d39738e4157b4e94fb29c93f2e.tar.gz sharkey-63a814c70e96a5d39738e4157b4e94fb29c93f2e.tar.bz2 sharkey-63a814c70e96a5d39738e4157b4e94fb29c93f2e.zip | |
fix(docs): correct information for drive upload (#8736)
| -rw-r--r-- | packages/backend/src/server/api/openapi/gen-spec.ts | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/packages/backend/src/server/api/openapi/gen-spec.ts b/packages/backend/src/server/api/openapi/gen-spec.ts index c6e557aefb..3929fff3f7 100644 --- a/packages/backend/src/server/api/openapi/gen-spec.ts +++ b/packages/backend/src/server/api/openapi/gen-spec.ts @@ -59,6 +59,18 @@ export function genOpenapiSpec(lang = 'ja-JP') { desc += ` / **Permission**: *${kind}*`; } + const requestType = endpoint.meta.requireFile ? 'multipart/form-data' : 'application/json'; + const schema = endpoint.params; + + if (endpoint.meta.requireFile) { + schema.properties.file = { + type: 'string', + format: 'binary', + description: 'The file contents.', + }; + schema.required.push('file'); + } + const info = { operationId: endpoint.name, summary: endpoint.name, @@ -78,8 +90,8 @@ export function genOpenapiSpec(lang = 'ja-JP') { requestBody: { required: true, content: { - 'application/json': { - schema: endpoint.params, + [requestType]: { + schema, }, }, }, |