فهرست منبع

wrrite swagger

itizawa 6 سال پیش
والد
کامیت
7732f47141
1فایلهای تغییر یافته به همراه49 افزوده شده و 4 حذف شده
  1. 49 4
      src/server/routes/apiv3/markdown-setting.js

+ 49 - 4
src/server/routes/apiv3/markdown-setting.js

@@ -22,13 +22,58 @@ module.exports = (crowi) => {
     Config,
     Config,
   } = crowi.models;
   } = crowi.models;
 
 
-  // TODO swagger
+  /**
+   * @swagger
+   *
+   *  paths:
+   *    /_api/v3/markdown-setting/xss:
+   *      put:
+   *        tags: [Users]
+   *        description: Update xss
+   *        parameters:
+   *          - name: markdown:xss:isEnabledPrevention
+   *            in: query
+   *            description: enable xss
+   *            schema:
+   *              type: boolean
+   *          - name: markdown:xss:option
+   *            in: query
+   *            description: xss option
+   *            schema:
+   *              type: number
+   *          - name: markdown:xss:tagWhiteList
+   *            in: query
+   *            description: custom tag whitelist
+   *            schema:
+   *              type: array
+   *              items:
+   *                type: string
+   *                description: tag whitelist
+   *          - name: markdown:xss:attrWhiteList
+   *            in: query
+   *            description: custom attr whitelist
+   *            schema:
+   *              type: array
+   *              items:
+   *                type: string
+   *                description: tag whitelist
+   *        responses:
+   *          200:
+   *            description: Updating xss success
+   *            content:
+   *              application/json:
+   *                schema:
+   *                  properties:
+   *                    xssParams:
+   *                      type: object
+   *                      description: new xss params
+   */
   router.put('/xss', loginRequiredStrictly, adminRequired, async(req, res) => {
   router.put('/xss', loginRequiredStrictly, adminRequired, async(req, res) => {
-    const array = req.body;
+    const xssParams = req.body;
 
 
     try {
     try {
-      await crowi.configManager.updateConfigsInTheSameNamespace('markdown', array);
-      return res.apiv3({ array });
+      await crowi.configManager.updateConfigsInTheSameNamespace('markdown', xssParams);
+      return res.apiv3({ xssParams });
     }
     }
     catch (err) {
     catch (err) {
       const msg = 'Error occurred in updating xss';
       const msg = 'Error occurred in updating xss';