Bladeren bron

add swagger docs

Yuki Takei 6 jaren geleden
bovenliggende
commit
95c5454fa9
1 gewijzigde bestanden met toevoegingen van 28 en 28 verwijderingen
  1. 28 28
      src/server/routes/apiv3/import.js

+ 28 - 28
src/server/routes/apiv3/import.js

@@ -149,36 +149,36 @@ module.exports = (crowi) => {
    *    post:
    *      tags: [Import]
    *      description: import a collection from a zipped json
-   *      parameters:
-   *        - name: fileName
-   *          in: path
-   *          description: the file name of zip file
-   *          required: true
-   *          schema:
-   *            type: string
-   *        - name: collections
-   *          description: collection names to import
-   *          required: true
-   *          schema:
-   *            type: array
-   *            items:
-   *              type: string
-   *        - name: optionsMap
-   *          description: the map object of importing option
-   *          schema:
-   *            type: object
+   *      requestBody:
+   *        required: true
+   *        content:
+   *          application/json:
+   *            schema:
+   *              type: object
+   *              properties:
+   *                fileName:
+   *                  description: the file name of zip file
+   *                  type: string
+   *                collections:
+   *                  description: collection names to import
+   *                  type: array
+   *                  items:
+   *                    type: string
+   *                optionsMap:
+   *                  description: |
+   *                    the map object of importing option that have collection name as the key
+   *                  additionalProperties:
+   *                    type: object
+   *                    properties:
+   *                      mode:
+   *                        description: Import mode
+   *                        type: string
+   *                        enum: [insert, upsert, flushAndInsert]
+   *                      schema:
+   *                        type: object
    *      responses:
    *        200:
-   *          description: the data is successfully imported
-   *          content:
-   *            application/json:
-   *              schema:
-   *                properties:
-   *                  results:
-   *                    type: array
-   *                    items:
-   *                      type: object
-   *                      description: collectionName, insertedIds, failedIds
+   *          description: Import process has requested
    */
   router.post('/', accessTokenParser, loginRequired, adminRequired, csrf, async(req, res) => {
     // TODO: add express validator