Explorar el Código

Merge pull request #9820 from goofmint/fix/doc-v3-healthcheck-oneof

support(jsdoc): Update doc v3 healthcheck
Yuki Takei hace 1 año
padre
commit
4edec2a6fe

+ 68 - 20
apps/app/src/server/routes/apiv3/healthcheck.ts

@@ -28,21 +28,54 @@ const router = express.Router();
  *            example: 'OK'
  *          searchInfo:
  *            type: object
- *            example: {
- *              "esVersion":"6.6.1",
- *              "esNodeInfos":{
- *                "6pnILIqFT_Cjbs4mwQfcmA": {
- *                  "name":"6pnILIq",
- *                  "version":"6.6.1",
- *                  "plugins":[
- *                    {"name":"analysis-icu","version":"6.6.1"},
- *                    {"name":"analysis-kuromoji","version":"6.6.1"},
- *                    {"name":"ingest-geoip","version":"6.6.1"},
- *                    {"name":"ingest-user-agent","version":"6.6.1"}
- *                  ]
- *                }
- *              }
- *            }
+ *            properties:
+ *              cluster_name:
+ *                type: string
+ *                example: elasticsearch
+ *              status:
+ *                type: string
+ *                enum: [green, yellow, red]
+ *                example: yellow
+ *              timed_out:
+ *                type: boolean
+ *                example: false
+ *              number_of_nodes:
+ *                type: integer
+ *                example: 1
+ *              number_of_data_nodes:
+ *                type: integer
+ *                example: 1
+ *              active_primary_shards:
+ *                type: integer
+ *                example: 2
+ *              active_shards:
+ *                type: integer
+ *                example: 2
+ *              relocating_shards:
+ *                type: integer
+ *                example: 0
+ *              initializing_shards:
+ *                type: integer
+ *                example: 0
+ *              unassigned_shards:
+ *                type: integer
+ *                example: 1
+ *              delayed_unassigned_shards:
+ *                type: integer
+ *                example: 0
+ *              number_of_pending_tasks:
+ *                type: integer
+ *                example: 0
+ *              number_of_in_flight_fetch:
+ *                type: integer
+ *                example: 0
+ *              task_max_waiting_in_queue_millis:
+ *                type: integer
+ *                example: 0
+ *              active_shards_percent_as_number:
+ *                type: number
+ *                format: float
+ *                example: 66.66666666666666
  */
 /** @param {import('~/server/crowi').default} crowi Crowi instance */
 module.exports = (crowi) => {
@@ -103,11 +136,19 @@ module.exports = (crowi) => {
    *          content:
    *            application/json:
    *              schema:
-   *                properties:
-   *                  info:
-   *                    $ref: '#/components/schemas/HealthcheckInfo'
+   *                oneOf:
+   *                  - type: object
+   *                    description: "Don't select checkServices"
+   *                    properties:
+   *                      status:
+   *                        type: string
+   *                  - type: object
+   *                    description: "Select checkServices"
+   *                    properties:
+   *                      info:
+   *                        $ref: '#/components/schemas/HealthcheckInfo'
    *        503:
-   *          description: Unhealthy
+   *          description: "errors occurs when using checkServicesStrictly"
    *          content:
    *            application/json:
    *              schema:
@@ -116,7 +157,14 @@ module.exports = (crowi) => {
    *                    type: array
    *                    description: Errors
    *                    items:
-   *                      $ref: '#/components/schemas/ErrorV3'
+   *                      type: object
+   *                      properties:
+   *                        message:
+   *                          type: string
+   *                        code:
+   *                          type: string
+   *                  info:
+   *                    $ref: '#/components/schemas/HealthcheckInfo'
    */
   router.get('/', nocache(), async(req, res: ApiV3Response) => {
     let checkServices = (() => {

+ 1 - 58
apps/app/src/server/routes/apiv3/staffs.js

@@ -21,66 +21,9 @@ const compareFunction = function(a, b) {
   return a.order - b.order;
 };
 
-/**
- * @swagger
- *
- * components:
- *   schemas:
- *     Staff:
- *       type: object
- *       properties:
- *         order:
- *           type: integer
- *           example: 1
- *         sectionName:
- *           type: string
- *           example: GROWI VILLAGE
- *         additionalClass:
- *           type: string
- *           example: ""
- *         memberGroups:
- *           type: array
- *           items:
- *             type: object
- *             properties:
- *               additionalClass:
- *                 type: string
- *                 example: col-md-12 my-4
- *               members:
- *                 type: array
- *                 items:
- *                   type: object
- *                   properties:
- *                     position:
- *                       type: string
- *                       example: Founder
- *                     name:
- *                       type: string
- *                       example: yuki-takei
- */
 /** @param {import('~/server/crowi').default} crowi Crowi instance */
 module.exports = (crowi) => {
-  /**
-   * @swagger
-   *
-   * /staffs:
-   *   get:
-   *     summary: Get staffs
-   *     security: []
-   *     tags: [Staff]
-   *     responses:
-   *       200:
-   *         description: Staffs fetched successfully
-   *         content:
-   *           application/json:
-   *             schema:
-   *               type: object
-   *               properties:
-   *                 contributors:
-   *                   type: array
-   *                   items:
-   *                     $ref: '#/components/schemas/Staff'
-   */
+
   router.get('/', async(req, res) => {
     const now = new Date();
     const growiCloudUri = await crowi.configManager.getConfig('app:growiCloudUri');