INTRODUCTION

A Swagger document generation tool that configures visual, testable API documents in an extremely simple way.

Two configurations are supported: using ES7 decorators or using plain JavaScript objects.

INSTALL

Install it in your project

  $ npm i decorator-doc --save
Copy the code

NOTE

Note that in controllers defined using ES7 decorator syntax, each controller is added with the name Swagger? The static property of the schema, which represents the Model of the current controller.

API DOC

FEATURE

  • Router. join the method does not meet the following requirements expectations
{
  id: "model id",
  list: [
    {
      id: "other id",
      name: "other name"}}]Copy the code

Because you cannot have the same attributes on the same Model when joining, you must use an alias for the definition

@router.join('othor', ['id as otherId', 'name'])
@router.response([
  id,
  {
    name: "list",
    description: "list",
    props: ['otherId', 'name']
  }
])
Copy the code

The top result would be

{
  id: "model id",
  list: [
    {
      otherId: "other id",
      name: "other name"}}]Copy the code