Skip to content

Commit

Permalink
Merge pull request #9311 from weseek/imprv/jsdoc-for-openapi
Browse files Browse the repository at this point in the history
support: JSDoc for OpenAPI document
  • Loading branch information
yuki-takei authored Oct 24, 2024
2 parents 89ac4b9 + 25917c4 commit 2d70d86
Show file tree
Hide file tree
Showing 29 changed files with 147 additions and 225 deletions.
65 changes: 65 additions & 0 deletions apps/app/bin/swagger-jsdoc/definition-apiv3.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,69 @@ module.exports = {
},
},
},
'x-tagGroups': [
{
name: 'User API',
tags: [
'Attachment',
'Bookmarks',
'Page',
'Pages',
'Revisions',
'ShareLinks',
'Users',
'',
'',
],
},
{
name: 'User Personal Settings API',
tags: [
'GeneralSetting',
'EditorSetting',
'InAppNotificationSettings',
'',
'',
'',
'',
'',
],
},
{
name: 'System Management API',
tags: [
'Home',
'AppSettings',
'SecuritySetting',
'MarkDownSetting',
'CustomizeSetting',
'Import',
'Export',
'MongoDB',
'NotificationSetting',
'SlackIntegrationSettings',
'SlackIntegrationSettings (with proxy)',
'SlackIntegrationSettings (without proxy)',
'SlackIntegrationLegacySetting',
'ShareLink Management',
'UserGroupRelations',
'UserGroups',
'Users Management',
'FullTextSearch Management',
],
},
{
name: 'Public API',
tags: [
'Healthcheck',
'Statistics',
'',
'',
'',
'',
'',
'',
],
},
],
};
8 changes: 1 addition & 7 deletions apps/app/src/server/routes/apiv3/admin-home.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ const express = require('express');

const router = express.Router();

/**
* @swagger
* tags:
* name: adminHome
*/

/**
* @swagger
*
Expand Down Expand Up @@ -47,7 +41,7 @@ module.exports = (crowi) => {
*
* /admin-home/:
* get:
* tags: [AdminHome]
* tags: [Admin]
* operationId: getAdminHome
* summary: /admin-home
* description: Get adminHome parameters
Expand Down
6 changes: 0 additions & 6 deletions apps/app/src/server/routes/apiv3/app-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ const express = require('express');

const router = express.Router();

/**
* @swagger
* tags:
* name: AppSettings
*/

/**
* @swagger
*
Expand Down
9 changes: 1 addition & 8 deletions apps/app/src/server/routes/apiv3/attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ const {
} = require('express-validator');


/**
* @swagger
* tags:
* name: Attachment
*/


/**
* @swagger
*
Expand Down Expand Up @@ -231,7 +224,7 @@ module.exports = (crowi) => {
*
* /attachment:
* post:
* tags: [Attachment, CrowiCompatibles]
* tags: [Attachment]
* operationId: addAttachment
* summary: /attachment
* description: Add attachment to the page
Expand Down
6 changes: 0 additions & 6 deletions apps/app/src/server/routes/apiv3/bookmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ const { body, query, param } = require('express-validator');

const router = express.Router();

/**
* @swagger
* tags:
* name: Bookmarks
*/

/**
* @swagger
*
Expand Down
6 changes: 0 additions & 6 deletions apps/app/src/server/routes/apiv3/customize-setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ const logger = loggerFactory('growi:routes:apiv3:customize-setting');
const router = express.Router();


/**
* @swagger
* tags:
* name: CustomizeSetting
*/

/**
* @swagger
*
Expand Down
6 changes: 0 additions & 6 deletions apps/app/src/server/routes/apiv3/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ const { param } = require('express-validator');

const router = express.Router();

/**
* @swagger
* tags:
* name: Export
*/

/**
* @swagger
*
Expand Down
6 changes: 0 additions & 6 deletions apps/app/src/server/routes/apiv3/healthcheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ const logger = loggerFactory('growi:routes:apiv3:healthcheck');

const router = express.Router();

/**
* @swagger
* tags:
* name: Healthcheck
*/

/**
* @swagger
*
Expand Down
6 changes: 0 additions & 6 deletions apps/app/src/server/routes/apiv3/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ const multer = require('multer');

const router = express.Router();

/**
* @swagger
* tags:
* name: Import
*/

/**
* @swagger
*
Expand Down
6 changes: 0 additions & 6 deletions apps/app/src/server/routes/apiv3/markdown-setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ const validator = {
};


/**
* @swagger
* tags:
* name: MarkDownSetting
*/

/**
* @swagger
*
Expand Down
8 changes: 1 addition & 7 deletions apps/app/src/server/routes/apiv3/mongo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ const mongoose = require('mongoose');

const router = express.Router();

/**
* @swagger
* tags:
* name: Mongo
*/

module.exports = (crowi) => {
const loginRequiredStrictly = require('../../middlewares/login-required')(crowi);
const adminRequired = require('../../middlewares/admin-required')(crowi);
Expand All @@ -22,7 +16,7 @@ module.exports = (crowi) => {
*
* /mongo/collections:
* get:
* tags: [Mongo]
* tags: [MongoDB]
* operationId: getMongoCollections
* summary: /mongo/collections
* description: get mongodb collections names
Expand Down
6 changes: 0 additions & 6 deletions apps/app/src/server/routes/apiv3/notification-setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ const validator = {
],
};

/**
* @swagger
* tags:
* name: NotificationSetting
*/

/**
* @swagger
*
Expand Down
10 changes: 2 additions & 8 deletions apps/app/src/server/routes/apiv3/page/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ const { body, query, param } = require('express-validator');

const router = express.Router();

/**
* @swagger
* tags:
* name: Page
*/


/**
* @swagger
Expand Down Expand Up @@ -671,9 +665,9 @@ module.exports = (crowi) => {
/**
* @swagger
*
* /pages/export:
* /page/export:
* get:
* tags: [Export]
* tags: [Page]
* description: return page's markdown
* responses:
* 200:
Expand Down
6 changes: 0 additions & 6 deletions apps/app/src/server/routes/apiv3/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ const router = express.Router();
const LIMIT_FOR_LIST = 10;
const LIMIT_FOR_MULTIPLE_PAGE_OP = 20;

/**
* @swagger
* tags:
* name: Pages
*/

/**
* @swagger
*
Expand Down
28 changes: 11 additions & 17 deletions apps/app/src/server/routes/apiv3/personal-setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ const passport = require('passport');

const router = express.Router();

/**
* @swagger
* tags:
* name: PersonalSetting
*/

/**
* @swagger
*
Expand Down Expand Up @@ -136,7 +130,7 @@ module.exports = (crowi) => {
*
* /personal-setting:
* get:
* tags: [PersonalSetting]
* tags: [GeneralSetting]
* operationId: getPersonalSetting
* summary: /personal-setting
* description: Get personal parameters
Expand Down Expand Up @@ -175,7 +169,7 @@ module.exports = (crowi) => {
*
* /personal-setting/is-password-set:
* get:
* tags: [PersonalSetting]
* tags: [GeneralSetting]
* operationId: getIsPasswordSet
* summary: /personal-setting
* description: Get whether a password has been set
Expand Down Expand Up @@ -210,7 +204,7 @@ module.exports = (crowi) => {
*
* /personal-setting:
* put:
* tags: [PersonalSetting]
* tags: [GeneralSetting]
* operationId: updatePersonalSetting
* summary: /personal-setting
* description: Update personal setting
Expand Down Expand Up @@ -267,7 +261,7 @@ module.exports = (crowi) => {
*
* /personal-setting/image-type:
* put:
* tags: [PersonalSetting]
* tags: [GeneralSetting]
* operationId: putUserImageType
* summary: /personal-setting/image-type
* description: Update user image type
Expand Down Expand Up @@ -304,7 +298,7 @@ module.exports = (crowi) => {
*
* /personal-setting/external-accounts:
* get:
* tags: [PersonalSetting]
* tags: [GeneralSetting]
* operationId: getExternalAccounts
* summary: /personal-setting/external-accounts
* description: Get external accounts that linked current user
Expand Down Expand Up @@ -338,7 +332,7 @@ module.exports = (crowi) => {
*
* /personal-setting/password:
* put:
* tags: [PersonalSetting]
* tags: [GeneralSetting]
* operationId: putUserPassword
* summary: /personal-setting/password
* description: Update user password
Expand Down Expand Up @@ -386,7 +380,7 @@ module.exports = (crowi) => {
*
* /personal-setting/api-token:
* put:
* tags: [PersonalSetting]
* tags: [GeneralSetting]
* operationId: putUserApiToken
* summary: /personal-setting/api-token
* description: Update user api token
Expand Down Expand Up @@ -424,7 +418,7 @@ module.exports = (crowi) => {
*
* /personal-setting/associate-ldap:
* put:
* tags: [PersonalSetting]
* tags: [GeneralSetting]
* operationId: associateLdapAccount
* summary: /personal-setting/associate-ldap
* description: associate Ldap account
Expand Down Expand Up @@ -476,7 +470,7 @@ module.exports = (crowi) => {
*
* /personal-setting/disassociate-ldap:
* put:
* tags: [PersonalSetting]
* tags: [GeneralSetting]
* operationId: disassociateLdapAccount
* summary: /personal-setting/disassociate-ldap
* description: disassociate Ldap account
Expand Down Expand Up @@ -609,7 +603,7 @@ module.exports = (crowi) => {
*
* /personal-setting/in-app-notification-settings:
* put:
* tags: [in-app-notification-settings]
* tags: [InAppNotificationSettings]
* operationId: putInAppNotificationSettings
* summary: personal-setting/in-app-notification-settings
* description: Put InAppNotificationSettings
Expand Down Expand Up @@ -653,7 +647,7 @@ module.exports = (crowi) => {
*
* /personal-setting/in-app-notification-settings:
* get:
* tags: [in-app-notification-settings]
* tags: [InAppNotificationSettings]
* operationId: getInAppNotificationSettings
* summary: personal-setting/in-app-notification-settings
* description: Get InAppNotificationSettings
Expand Down
Loading

0 comments on commit 2d70d86

Please sign in to comment.