📝 fix Swagger docs (#355)

This commit is contained in:
Anton Shepilov
2024-02-02 19:37:53 +03:00
committed by GitHub
parent 5621d6b305
commit b35687829c
4 changed files with 18 additions and 5 deletions
@@ -17,6 +17,7 @@
"level": "LOG_LEVEL" "level": "LOG_LEVEL"
}, },
"webserver": { "webserver": {
"host": "TWAKE_DRIVE_HOST",
"logger": { "logger": {
"level": "LOG_LEVEL" "level": "LOG_LEVEL"
}, },
+1
View File
@@ -43,6 +43,7 @@
} }
}, },
"webserver": { "webserver": {
"host": "localhost",
"port": 4000, "port": 4000,
"logger": { "logger": {
"level": "info" "level": "info"
@@ -15,7 +15,6 @@ import { SkipCLI } from "../../framework/decorators/skip";
import fs from "fs"; import fs from "fs";
import { ExecutionContext, executionStorage } from "../../framework/execution-storage"; import { ExecutionContext, executionStorage } from "../../framework/execution-storage";
// import { throws } from "assert";
export default class WebServerService extends TdriveService<WebServerAPI> implements WebServerAPI { export default class WebServerService extends TdriveService<WebServerAPI> implements WebServerAPI {
name = "webserver"; name = "webserver";
version = "1"; version = "1";
@@ -81,15 +80,15 @@ export default class WebServerService extends TdriveService<WebServerAPI> implem
swagger: { swagger: {
info: { info: {
title: "Tdrive Swagger", title: "Tdrive Swagger",
description: "Automatically generate Tdrive Swagger API", description: "Automatically generated Twake Drive Swagger API",
version: "0.1.0", version: "0.1.0",
}, },
externalDocs: { externalDocs: {
url: "http://linagora.github.io/Tdrive", url: "https://linagora.github.io/twake-drive",
description: "Find more info here", description: "Find more info here",
}, },
host: "localhost", host: this.configuration.get<string>("host"),
schemes: ["http"], schemes: ["https", "http"],
consumes: ["application/json"], consumes: ["application/json"],
produces: ["application/json"], produces: ["application/json"],
tags: [], tags: [],
@@ -130,6 +130,17 @@ export const getUserSchema = {
required: ["resource"], required: ["resource"],
}, },
}, },
tags: ["User"],
params: {
type: "object",
description: "Users",
properties: {
id: {
description: "User ID",
type: "string",
},
},
},
}; };
export const setUserPreferencesSchema = { export const setUserPreferencesSchema = {
@@ -146,6 +157,7 @@ export const setUserPreferencesSchema = {
}, },
required: [] as any[], required: [] as any[],
}, },
tags: ["User"],
response: { response: {
"2xx": userObjectSchema.properties.preferences, "2xx": userObjectSchema.properties.preferences,
}, },