definition-apiv3.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. const pkg = require('../../package.json');
  2. module.exports = {
  3. openapi: '3.0.1',
  4. info: {
  5. title: 'GROWI REST API v3',
  6. version: pkg.version,
  7. },
  8. servers: [
  9. {
  10. url: '{server}/_api/v3',
  11. variables: {
  12. server: {
  13. default: 'https://demo.growi.org',
  14. description: 'The base URL for the GROWI API except for the version path (/_api/v3). This can be set to your GROWI instance URL.',
  15. },
  16. },
  17. },
  18. {
  19. url: 'https://demo.growi.org/_api/v3',
  20. },
  21. ],
  22. security: [
  23. {
  24. bearer: [],
  25. accessTokenInQuery: [],
  26. },
  27. ],
  28. components: {
  29. securitySchemes: {
  30. bearer: {
  31. type: 'http',
  32. scheme: 'bearer',
  33. description: 'Access token generated by each GROWI users',
  34. },
  35. accessTokenInQuery: {
  36. type: 'apiKey',
  37. name: 'access_token',
  38. in: 'query',
  39. description: 'Access token generated by each GROWI users',
  40. },
  41. cookieAuth: {
  42. type: 'apiKey',
  43. in: 'cookie',
  44. name: 'connect.sid',
  45. },
  46. transferHeaderAuth: {
  47. type: 'apiKey',
  48. in: 'header',
  49. name: 'x-growi-transfer-key',
  50. },
  51. adminRequired: {
  52. type: 'http',
  53. scheme: 'bearer',
  54. bearerFormat: 'AdminAccess',
  55. description: 'Requires an authenticated user with admin privileges',
  56. },
  57. },
  58. responses: {
  59. 400: {
  60. description: 'Bad request.',
  61. content: {
  62. 'application/json': {
  63. schema: {
  64. $ref: '#/components/schemas/ErrorResponse',
  65. },
  66. },
  67. },
  68. },
  69. 401: {
  70. description: 'Unauthorized.',
  71. content: {
  72. 'application/json': {
  73. schema: {
  74. $ref: '#/components/schemas/ErrorResponse',
  75. },
  76. },
  77. },
  78. },
  79. 403: {
  80. description: 'Forbidden.',
  81. content: {
  82. 'application/json': {
  83. schema: {
  84. $ref: '#/components/schemas/ErrorResponse',
  85. },
  86. },
  87. },
  88. },
  89. 404: {
  90. description: 'Not found.',
  91. content: {
  92. 'application/json': {
  93. schema: {
  94. $ref: '#/components/schemas/ErrorResponse',
  95. },
  96. },
  97. },
  98. },
  99. 500: {
  100. description: 'Internal server error.',
  101. content: {
  102. 'application/json': {
  103. schema: {
  104. $ref: '#/components/schemas/ErrorResponse',
  105. },
  106. },
  107. },
  108. },
  109. },
  110. schemas: {
  111. ErrorResponse: {
  112. type: 'object',
  113. description: 'Standard error response format for API failures.',
  114. properties: {
  115. message: {
  116. type: 'string',
  117. description: 'A human-readable message providing details about the error.',
  118. },
  119. status: {
  120. type: 'number',
  121. description: 'The HTTP status code associated with the error (e.g., 400, 401, 500).',
  122. },
  123. },
  124. },
  125. MarkdownParams: {
  126. type: 'object',
  127. description: 'All current Markdown rendering settings.',
  128. properties: {
  129. isEnabledLinebreaks: { type: 'boolean', description: 'Controls if line breaks are enabled in Markdown.' },
  130. isEnabledLinebreaksInComments: { type: 'boolean', description: 'Controls if line breaks are enabled in Markdown comments.' },
  131. adminPreferredIndentSize: { type: 'number', enum: [2, 4], description: 'Preferred indent size for Markdown, either 2 or 4 spaces.' },
  132. isIndentSizeForced: { type: 'boolean', description: 'If true, forces the preferred indent size across all users.' },
  133. isEnabledXss: { type: 'boolean', description: 'Controls if XSS prevention is enabled.' },
  134. xssOption: { type: 'string', description: 'The XSS prevention option.' },
  135. tagWhitelist: { type: 'array', items: { type: 'string' }, description: 'List of HTML tags allowed if XSS prevention is enabled.' },
  136. attrWhitelist: { type: 'string', description: 'Stringified JSON object of allowed attributes for whitelisted tags.' },
  137. },
  138. },
  139. LineBreakParams: {
  140. type: 'object',
  141. description: 'Parameters for Markdown line break settings.',
  142. properties: {
  143. isEnabledLinebreaks: { type: 'boolean', description: 'Enable or disable line breaks.' },
  144. isEnabledLinebreaksInComments: { type: 'boolean', description: 'Enable or disable line breaks in comments.' },
  145. },
  146. },
  147. IndentParams: {
  148. type: 'object',
  149. description: 'Parameters for Markdown indent settings.',
  150. properties: {
  151. adminPreferredIndentSize: { type: 'number', enum: [2, 4], description: 'The preferred indent size (2 or 4).' },
  152. isIndentSizeForced: { type: 'boolean', description: 'Force preferred indent size for all users.' },
  153. },
  154. },
  155. XssParams: {
  156. type: 'object',
  157. description: 'Parameters for Markdown XSS prevention settings.',
  158. properties: {
  159. isEnabledXss: { type: 'boolean', description: 'Enable or disable XSS prevention.' },
  160. xssOption: { type: 'string', description: 'XSS prevention option (e.g., "permissive", "strict").' }, // Adjust enum if known values exist
  161. tagWhitelist: { type: 'array', items: { type: 'string' }, description: 'Array of whitelisted HTML tags.' },
  162. attrWhitelist: { type: 'string', description: 'Stringified JSON of whitelisted HTML attributes.' },
  163. },
  164. },
  165. },
  166. parameters: {
  167. MimeTypePathParam: {
  168. name: 'mimeType',
  169. in: 'path',
  170. required: true,
  171. description: 'Configurable MIME type (e.g., image/png, application/pdf)',
  172. schema: {
  173. type: 'string',
  174. enum: [
  175. 'image/jpeg',
  176. 'image/png',
  177. 'image/gif',
  178. 'image/webp',
  179. 'image/bmp',
  180. 'image/tiff',
  181. 'image/x-icon',
  182. 'application/pdf',
  183. 'text/plain',
  184. 'video/mp4',
  185. 'video/webm',
  186. 'video/ogg',
  187. 'audio/mpeg',
  188. 'audio/ogg',
  189. 'audio/wav',
  190. 'text/html',
  191. 'text/javascript',
  192. 'application/javascript',
  193. 'image/svg+xml',
  194. 'application/xml',
  195. 'application/json',
  196. 'application/x-sh',
  197. 'application/x-msdownload',
  198. 'application/octet-stream',
  199. 'application/msword',
  200. 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
  201. 'application/vnd.ms-excel',
  202. 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
  203. 'application/vnd.ms-powerpoint',
  204. 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
  205. 'application/zip',
  206. 'application/x-rar-compressed',
  207. 'text/csv',
  208. ],
  209. },
  210. },
  211. },
  212. },
  213. 'x-tagGroups': [
  214. {
  215. name: 'User API',
  216. tags: [
  217. 'Attachment',
  218. 'Bookmarks',
  219. 'BookmarkFolders',
  220. 'Page',
  221. 'Pages',
  222. 'PageListing',
  223. 'Revisions',
  224. 'ShareLinks',
  225. 'Users',
  226. 'UserUISettings',
  227. ],
  228. },
  229. {
  230. name: 'User Personal Settings API',
  231. tags: [
  232. 'GeneralSetting',
  233. 'EditorSetting',
  234. 'InAppNotificationSettings',
  235. ],
  236. },
  237. {
  238. name: 'System Management API',
  239. tags: [
  240. 'Home',
  241. 'Activity',
  242. 'AdminHome',
  243. 'AppSettings',
  244. 'ExternalUserGroups',
  245. 'SecuritySetting',
  246. 'MarkDownSetting',
  247. 'CustomizeSetting',
  248. 'Import',
  249. 'Export',
  250. 'GROWI to GROWI Transfer',
  251. 'MongoDB',
  252. 'NotificationSetting',
  253. 'Plugins',
  254. 'Questionnaire',
  255. 'QuestionnaireSetting',
  256. 'SlackIntegration',
  257. 'SlackIntegrationSettings',
  258. 'SlackIntegrationSettings (with proxy)',
  259. 'SlackIntegrationSettings (without proxy)',
  260. 'SlackIntegrationLegacySetting',
  261. 'ShareLink Management',
  262. 'Templates',
  263. 'Staff',
  264. 'UserGroupRelations',
  265. 'UserGroups',
  266. 'Users Management',
  267. 'FullTextSearch Management',
  268. 'Install',
  269. ],
  270. },
  271. {
  272. name: 'Public API',
  273. tags: [
  274. 'Healthcheck',
  275. 'Statistics',
  276. ],
  277. },
  278. ],
  279. };