swagger-definition.js 699 B

12345678910111213141516171819202122232425262728293031323334353637
  1. const pkg = require('../package.json');
  2. const apiVersion = process.env.API_VERSION || '3';
  3. const basePath = (apiVersion === '1' ? '/_api' : `/_api/v${apiVersion}`);
  4. module.exports = {
  5. openapi: '3.0.1',
  6. info: {
  7. title: `GROWI REST API v${apiVersion}`,
  8. version: pkg.version,
  9. },
  10. servers: [
  11. {
  12. url: 'https://demo.growi.org{basePath}',
  13. variables: {
  14. basePath: {
  15. default: basePath,
  16. description: 'base path',
  17. },
  18. },
  19. },
  20. ],
  21. security: [
  22. {
  23. api_key: [],
  24. },
  25. ],
  26. components: {
  27. securitySchemes: {
  28. api_key: {
  29. type: 'apiKey',
  30. name: 'access_token',
  31. in: 'query',
  32. },
  33. },
  34. },
  35. };