mizozobu 6 years ago
parent
commit
3227a7a7e5

+ 16 - 7
src/server/routes/apiv3/export.js

@@ -24,13 +24,18 @@ module.exports = (crowi) => {
    *    get:
    *      tags: [Export]
    *      description: get properties of zip files for export
-   *      produces:
-   *        - application/json
    *      responses:
    *        200:
    *          description: export cache status
    *          content:
    *            application/json:
+   *              schema:
+   *                properties:
+   *                  zipFileStats:
+   *                    type: array
+   *                    items:
+   *                      type: object
+   *                      description: property of each file
    */
   router.get('/status', async(req, res) => {
     const zipFileStats = await exportService.getStatus();
@@ -46,13 +51,16 @@ module.exports = (crowi) => {
    *    post:
    *      tags: [Export]
    *      description: generate a zipped json for multiple collections
-   *      produces:
-   *        - application/json
    *      responses:
    *        200:
    *          description: a zip file is generated
    *          content:
    *            application/json:
+   *              schema:
+   *                properties:
+   *                  zipFileStat:
+   *                    type: object
+   *                    description: property of each file
    */
   router.post('/', async(req, res) => {
     // TODO: add express validator
@@ -91,16 +99,15 @@ module.exports = (crowi) => {
   /**
    * @swagger
    *
-   *  /export:
+   *  /export/{fileName}:
    *    delete:
    *      tags: [Export]
    *      description: unlink all json and zip files for exports
-   *      produces:
-   *        - application/json
    *      parameters:
    *        - name: fileName
    *          in: path
    *          description: file name of zip file
+   *          required: true
    *          schema:
    *            type: string
    *      responses:
@@ -108,6 +115,8 @@ module.exports = (crowi) => {
    *          description: the json and zip file are deleted
    *          content:
    *            application/json:
+   *              schema:
+   *                type: object
    */
   router.delete('/:fileName', async(req, res) => {
     // TODO: add express validator

+ 16 - 18
src/server/routes/apiv3/import.js

@@ -86,13 +86,13 @@ module.exports = (crowi) => {
    *    post:
    *      tags: [Import]
    *      description: import a collection from a zipped json
-   *      produces:
-   *        - application/json
    *      responses:
    *        200:
    *          description: data is successfully imported
    *          content:
    *            application/json:
+   *              schema:
+   *                type: object
    */
   router.post('/', async(req, res) => {
     // TODO: add express validator
@@ -142,8 +142,6 @@ module.exports = (crowi) => {
    *    post:
    *      tags: [Import]
    *      description: upload a zip file
-   *      produces:
-   *        - application/json
    *      responses:
    *        200:
    *          description: file is uploaded
@@ -151,18 +149,17 @@ module.exports = (crowi) => {
    *            application/json:
    *              schema:
    *                properties:
-   *                  properties:
-   *                    meta:
+   *                  meta:
+   *                    type: object
+   *                    description: meta data of the uploaded file
+   *                  fileName:
+   *                    type: string
+   *                    description: base name of the uploaded file
+   *                  fileStats:
+   *                    type: array
+   *                    items:
    *                      type: object
-   *                      description: meta data of the uploaded file
-   *                    fileName:
-   *                      type: string
-   *                      description: base name of the uploaded file
-   *                    fileStats:
-   *                      type: array
-   *                      items:
-   *                        type: object
-   *                        description: property of each extracted file
+   *                      description: property of each extracted file
    */
   router.post('/upload', uploads.single('file'), async(req, res) => {
     const { file } = req;
@@ -190,16 +187,15 @@ module.exports = (crowi) => {
   /**
    * @swagger
    *
-   *  /import/upload:
+   *  /import/{fileName}:
    *    post:
    *      tags: [Import]
    *      description: delete a zip file
-   *      produces:
-   *        - application/json
    *      parameters:
    *        - name: fileName
    *          in: path
    *          description: file name of zip file
+   *          required: true
    *          schema:
    *            type: string
    *      responses:
@@ -207,6 +203,8 @@ module.exports = (crowi) => {
    *          description: file is deleted
    *          content:
    *            application/json:
+   *              schema:
+   *                type: object
    */
   router.delete('/:fileName', async(req, res) => {
     const { fileName } = req.params;

+ 0 - 2
src/server/routes/apiv3/mongo.js

@@ -20,8 +20,6 @@ module.exports = (crowi) => {
    *    get:
    *      tags: [Mongo]
    *      description: get mongodb collections names
-   *      produces:
-   *        - application/json
    *      responses:
    *        200:
    *          description: list of collections in mongoDB