1.0.1 • Published 2 years ago

serverless-node-swag v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

serverless-node-swag

为serverless的node云函数的注释生成符合swagger2规范的json

API Operation

annotationdescription
descriptionA verbose explanation of the operationbehavior.
idA unique string used to identify the operation. Must be unique among all API operations.
tagsA list of tags to each API operation that separated by commas.
summaryA short summary of what the operation does.
acceptA list of MIME types the APIs can consume. Note that Accept only affects operations with a request body, such as POST, PUT and PATCH. Value MUST be as described under Mime Types.
produceA list of MIME types the APIs can produce. Value MUST be as described under Mime Types.
paramParameters that separated by spaces. param name,param type,data type,is mandatory?,comment attribute(optional)
securitySecurity to each API operation.
successSuccess response that separated by spaces. return code or default,{param type},data type,comment
failureFailure response that separated by spaces. return code or default,{param type},data type,comment
responseAs same as success and failure
headerHeader in response that separated by spaces. return code,{param type},data type,comment
routerPath definition that separated by spaces. path,httpMethod
x-nameThe extension key, must be start by x- and take only json value.
x-codeSampleOptional Markdown usage. take file as parameter. This will then search for a file named like the summary in the given folder.
deprecatedMark endpoint as deprecated.

Mime Type

swag accepts all MIME Types which are in the correct format, that is, match /. Besides that, swag also accepts aliases for some MIME Types as follows:

AliasMIME Type
jsonapplication/json
xmltext/xml
plaintext/plain
htmltext/html
mpfdmultipart/form-data
x-www-form-urlencodedapplication/x-www-form-urlencoded
json-apiapplication/vnd.api+json
json-streamapplication/x-json-stream
octet-streamapplication/octet-stream
pngimage/png
jpegimage/jpeg
gifimage/gif

Data Type

  • string
  • number
  • boolean
  • array
  • object

Param Type

  • query
  • path
  • header
  • body
  • formData