Просмотр исходного кода

Merge pull request #9340 from goofmint/features/swagger-admin-home

support(jsdoc): Add Swagger doc to /_api/v3/admin-home/
Yuki Takei 1 год назад
Родитель
Сommit
28982d0275

+ 1 - 0
apps/app/bin/swagger-jsdoc/definition-apiv3.js

@@ -57,6 +57,7 @@ module.exports = {
       name: 'System Management API',
       tags: [
         'Home',
+        'AdminHome',
         'AppSettings',
         'SecuritySetting',
         'MarkDownSetting',

+ 33 - 7
apps/app/src/server/routes/apiv3/admin-home.js

@@ -14,16 +14,41 @@ const router = express.Router();
  *        properties:
  *          growiVersion:
  *            type: string
- *            description: version of growi
+ *            description: GROWI version or '-'
+ *            example: 7.1.0-RC.0
  *          nodeVersion:
  *            type: string
- *            description: version of node
+ *            description: node version or '-'
+ *            example: 20.2.0
  *          npmVersion:
  *            type: string
- *            description: version of npm
+ *            description: npm version or '-'
+ *            example: 9.6.6
  *          pnpmVersion:
  *            type: string
- *            description: version of pnpm
+ *            description: pnpm version or '-'
+ *            example: 9.12.3
+ *          envVars:
+ *            type: object
+ *            description: environment variables
+ *            additionalProperties:
+ *              type: string
+ *            example:
+ *              "FILE_UPLOAD": "mongodb"
+ *              "APP_SITE_URL": "http://localhost:3000"
+ *              "ELASTICSEARCH_URI": "http://elasticsearch:9200/growi"
+ *              "ELASTICSEARCH_REQUEST_TIMEOUT": 15000
+ *              "ELASTICSEARCH_REJECT_UNAUTHORIZED": true
+ *              "OGP_URI": "http://ogp:8088"
+ *              "QUESTIONNAIRE_SERVER_ORIGIN": "http://host.docker.internal:3003"
+ *          isV5Compatible:
+ *            type: boolean
+ *            description: This value is true if this GROWI is compatible v5.
+ *            example: true
+ *          isMaintenanceMode:
+ *            type: boolean
+ *            description: This value is true if this site is maintenance mode.
+ *            example: false
  *      InstalledPluginsParams:
  *        type: object
  *        properties:
@@ -41,9 +66,11 @@ module.exports = (crowi) => {
    *
    *    /admin-home/:
    *      get:
-   *        tags: [Admin]
+   *        tags: [AdminHome]
    *        operationId: getAdminHome
    *        summary: /admin-home
+   *        security:
+   *          - cookieAuth: []
    *        description: Get adminHome parameters
    *        responses:
    *          200:
@@ -53,8 +80,7 @@ module.exports = (crowi) => {
    *                schema:
    *                  properties:
    *                    adminHomeParams:
-   *                      type: object
-   *                      description: adminHome params
+   *                      $ref: "#/components/schemas/SystemInformationParams"
    */
   router.get('/', loginRequiredStrictly, adminRequired, async(req, res) => {
     const adminHomeParams = {