feathers-swagger
Advanced tools
Comparing version 0.3.3 to 0.3.4
# Change Log | ||
## [v0.3.3](https://github.com/feathersjs/feathers-swagger/tree/v0.3.3) (2017-03-15) | ||
[Full Changelog](https://github.com/feathersjs/feathers-swagger/compare/v0.3.2...v0.3.3) | ||
**Closed issues:** | ||
- Use default swagger-ui? [\#38](https://github.com/feathersjs/feathers-swagger/issues/38) | ||
- can i use custom swagger-ui? [\#32](https://github.com/feathersjs/feathers-swagger/issues/32) | ||
- ENOENT: no such file or directory [\#31](https://github.com/feathersjs/feathers-swagger/issues/31) | ||
**Merged pull requests:** | ||
- Added option to display default Swagger UI \(closes \#38\) [\#40](https://github.com/feathersjs/feathers-swagger/pull/40) ([sinedied](https://github.com/sinedied)) | ||
- Update feathers-authentication to version 1.0.2 🚀 [\#34](https://github.com/feathersjs/feathers-swagger/pull/34) ([greenkeeperio-bot](https://github.com/greenkeeperio-bot)) | ||
## [v0.3.2](https://github.com/feathersjs/feathers-swagger/tree/v0.3.2) (2016-12-12) | ||
@@ -4,0 +18,0 @@ [Full Changelog](https://github.com/feathersjs/feathers-swagger/compare/v0.3.1...v0.3.2) |
@@ -102,5 +102,8 @@ 'use strict'; | ||
var doc = service.docs; | ||
var group = path.split('/'); | ||
var tag = path.indexOf('/') > -1 ? group[0] : path; | ||
var model = path.indexOf('/') > -1 ? group[1] : path; | ||
var version = path.match(config.versionPrefix); | ||
version = version ? ' ' + version[0] : ''; | ||
var apiPath = path.replace(config.prefix, ''); | ||
var group = apiPath.split('/'); | ||
var tag = (apiPath.indexOf('/') > -1 ? group[0] : apiPath) + version; | ||
var model = apiPath.indexOf('/') > -1 ? group[1] : apiPath; | ||
var security = {}; | ||
@@ -107,0 +110,0 @@ |
{ | ||
"name": "feathers-swagger", | ||
"description": "Add documentation to your Featherjs services and feed them to Swagger UI.", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"homepage": "https://github.com/feathersjs/feathers-swagger", | ||
@@ -6,0 +6,0 @@ "main": "lib/", |
@@ -232,2 +232,46 @@ # feathers-swagger | ||
### Prefixed routes | ||
If your are using versioned or prefixed routes for your API like `/api/<version>/users`, you can configure it using the | ||
`prefix` property so all your services don't end up in the same group. The value of the `prefix` property can be either | ||
a string or a RegEx. | ||
```js | ||
const app = feathers() | ||
.use(bodyParser.json()) | ||
.use(bodyParser.urlencoded({ extended: true })) | ||
.configure(rest()) | ||
.configure(swagger({ | ||
prefix: /api\/v\d\//, | ||
docsPath: '/docs', | ||
info: { | ||
title: 'A test', | ||
description: 'A description' | ||
} | ||
})) | ||
.use('/api/v1/messages', messageService); | ||
app.listen(3030); | ||
``` | ||
To display your API version alongside the service name, you can also define a `versionPrefix` to be extracted: | ||
```js | ||
const app = feathers() | ||
.use(bodyParser.json()) | ||
.use(bodyParser.urlencoded({ extended: true })) | ||
.configure(rest()) | ||
.configure(swagger({ | ||
prefix: /api\/v\d\//, | ||
versionPrefix: /v\d/, | ||
docsPath: '/docs', | ||
info: { | ||
title: 'A test', | ||
description: 'A description' | ||
} | ||
})) | ||
.use('/api/v1/messages', messageService); | ||
app.listen(3030); | ||
``` | ||
## License | ||
@@ -234,0 +278,0 @@ |
228887
1410
281