【文件属性】:
文件名称:mongoose-to-swagger:用于将Mongoose模式对象转换为Swagger模式定义的转换库
文件大小:1.1MB
文件格式:ZIP
更新时间:2021-02-03 04:11:46
documentation docs mongoose swagger documentation-tool
猫鼬到招摇
用于将模式对象转换为模式定义的转换库。
安装
$ npm install --save mongoose-to-swagger
总览
将猫鼬模型转换为一般模式。
用法
const mongoose = require ( 'mongoose' ) ;
const m2s = require ( 'mongoose-to-swagger' ) ;
const Cat = mongoose . model ( 'Cat' , { name : String } ) ;
const swaggerSchema = m2s ( Cat ) ;
console . log ( swaggerSchema ) ;
元属性
默认情况下,从猫鼬模式定义中提取description , enum和required字段,并将其放入相应的swagger属性定义中。 可以使用options参数上的props数组将其他meta props列入白名单。
const Cat = mongoose . model ( 'Cat' , {
name : {
type : Stri
【文件预览】:
mongoose-to-swagger-master
----.gitattributes(12B)
----.eslintrc.js(821B)
----.vscode()
--------launch.json(904B)
--------settings.json(290B)
----lib()
--------index.ts(7KB)
--------index.test.ts(18KB)
----examples()
--------demo()
--------generate_swagger.js(245B)
----.travis.yml(146B)
----tsconfig.json(676B)
----LICENSE(1KB)
----test()
--------index.ts(2KB)
--------mocha.opts(93B)
----README.md(2KB)
----.editorconfig(171B)
----.gitignore(47B)
----package-lock.json(103KB)
----package.json(1KB)