nocobase/packages/plugins/@nocobase/plugin-api-doc
mahuantest 2bde4a3176
Some checks failed
auto-merge / push-commit (push) Waiting to run
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase Backend Test / sqlite-test (20, false) (push) Waiting to run
NocoBase Backend Test / sqlite-test (20, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, nocobase, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, nocobase, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, public, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, public, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, public, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, public, true) (push) Waiting to run
NocoBase Backend Test / mysql-test (20, false) (push) Waiting to run
NocoBase Backend Test / mysql-test (20, true) (push) Waiting to run
NocoBase Backend Test / mariadb-test (20, false) (push) Waiting to run
NocoBase Backend Test / mariadb-test (20, true) (push) Waiting to run
Test on Windows / build (push) Waiting to run
deploy client docs / Build (push) Has been cancelled
NocoBase FrontEnd Test / frontend-test (18) (push) Has been cancelled
feat(locale): update and improve Japanese translations in ja_JP files (#5292)
* feat(locale): update and improve Japanese translations in ja_JP files

* fix(locale): correct japanese translations in ja_JP files

---------

Co-authored-by: mahuan <1007409254@qq.com>
2024-09-24 14:50:13 +08:00
..
src feat(locale): update and improve Japanese translations in ja_JP files (#5292) 2024-09-24 14:50:13 +08:00
.npmignore
client.d.ts
client.js
LICENSE
package.json chore(versions): 😊 publish v1.3.24-beta 2024-09-23 09:25:16 +00:00
README.md
README.zh-CN.md
server.d.ts
server.js

api-doc

English | 中文

Introduction

This plugin is based on swagger to write documentation.

How to access the documentation

  1. The access address in the plugin center is {domain}/admin/settings/api-doc/documentation
  2. The access address outside the plugin center is {domain}/api-documentation

How to write swagger documentation

The method in the plugin is the same

  1. src/swagger.{ts,json}
  2. src/swagger/index.{ts,json}

The file paths above can all be traversed to write documentation. Just export your written documentation by default. An example is shown below:

export default {
  info: {
    title: 'NocoBase API - Api-doc plugin',
  },
  tags: [],
  paths: {},
  components: {
    schemas: {}
  }
};

Usually, you only need to write info.title, tags, paths, and components. Other information such as server and info are merged into our base-swagger.

Base swagger includes the following code:

// base swagger
export default {
  openapi: '3.0.3',
  info: {
    title: 'NocoBase API documentation',
    description: '',
    contact: {
      url: 'https://github.com/nocobase/nocobase/issues',
    },
    license: {
      name: 'Core packages are Apache 2.0 & Plugins packages are AGPL 3.0 licensed.',
      url: 'https://github.com/nocobase/nocobase#license',
    },
  },
  externalDocs: {
    description: 'Find out more about NocoBase',
    url: 'https://docs.nocobase.com/',
  },
  components: {
    securitySchemes: {
      'api-key': {
        type: 'http',
        scheme: 'bearer',
      },
    },
  },
  security: [
    {
      'api-key': [],
    },
  ],
};

Note that configurations that can only be obtained at runtime, such as the server and version fields, are not filled in the base-swagger.

You can also override these defaults. When writing the swagger documentation for your plugin, you should consider whether your plugin's documentation can be accessed independently.

For detailed swagger writing rules, please refer to the official documentation.