Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alfierichou/joi-swagger-three
Using swagger3.0 & joi to generate swagger.json
https://github.com/alfierichou/joi-swagger-three
express joi swagger
Last synced: 4 days ago
JSON representation
Using swagger3.0 & joi to generate swagger.json
- Host: GitHub
- URL: https://github.com/alfierichou/joi-swagger-three
- Owner: AlfieriChou
- License: mit
- Created: 2018-08-13T14:01:08.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-12-15T18:44:39.000Z (7 days ago)
- Last Synced: 2024-12-15T19:36:55.525Z (7 days ago)
- Topics: express, joi, swagger
- Language: JavaScript
- Size: 255 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 35
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# joi swagger three
[![Greenkeeper badge](https://badges.greenkeeper.io/AlfieriChou/joi-swagger-three.svg)](https://greenkeeper.io/)
[![Build Status][travis-image]][travis-url]
[![codecov][codecov-image]][codecov-url]
[![Dependency Status][daviddm-image]][daviddm-url]
[![license][license-image]][license-url][![standard][standard-image]][standard-url]
### model
#### props
```javascript
const props = {
id: Joi.number().integer().description('id'),
tag_name: Joi.string().description('标签名称'),
description: Joi.string().description('标签描述')
}
```#### schema
```javascript
schema: Joi.object().items(props).description('标签信息表')
```#### index
```javascript
index: {
path: '/tags',
method: 'get',
tags: ['tag'],
summary: "获取标签信息列表",
query: _.pick(props, ['tag_name']),
output: Joi.array().items(props).description('返回信息')
}
```
#### create
```javascript
create: {
path: '/tags',
method: 'post',
tags: ['tag'],
summary: '创建标签信息',
requestBody: {
body: _.pick(props, ['tag_name', 'description']),
required: ['tag_name']
}
}
```#### show
```javascript
update: {
path: '/tags/{id}',
method: 'get',
tags: ['tag'],
summary: '获取标签信息',
params: _.pick(props, ['id'])
}
```
#### update
```javascript
update: {
path: '/tags/{id}',
method: 'put',
tags: ['tag'],
summary: '更新标签信息',
params: _.pick(props, ['id'])
}
```#### destroy
```javascript
update: {
path: '/tags/{id}',
method: 'delete',
tags: ['tag'],
summary: '删除标签信息',
params: _.pick(props, ['id'])
}
```[travis-image]: https://travis-ci.org/AlfieriChou/joi-swagger-three.svg?branch=master
[travis-url]: https://travis-ci.org/AlfieriChou/joi-swagger-three
[codecov-image]: https://codecov.io/gh/AlfieriChou/joi-swagger-three/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/AlfieriChou/joi-swagger-three
[daviddm-image]: https://david-dm.org/AlfieriChou/joi-swagger-three.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/AlfieriChou/joi-swagger-three
[license-image]: https://img.shields.io/badge/License-MIT-yellow.svg
[license-url]: https://opensource.org/licenses/MIT
[standard-image]:
https://cdn.rawgit.com/standard/standard/master/badge.svg
[standard-url]:
https://github.com/standard/standard