Skip to content

Commit d58d788

Browse files
authored
Update README.md
1 parent d322cd4 commit d58d788

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@
22

33
[![Build Status](https://travis-ci.org/michalstocki/swagger-json-filter.svg?branch=master)](https://travis-ci.org/michalstocki/swagger-json-filter)
44

5-
Command-line tool for filtering documentation created with Swagger.
5+
Command-line tool for filtering documentation created with [Swagger](http://swagger.io/).
66

77
The filter matches all paths defined in the input JSON against the given regular expression. Definition of all paths that don't match given regex, are removed. In the second step tool filters all data structure definitions and removes all that are not used within the remaining part of the paths.
88

99
## Usage
1010

1111
### as node.js package
12-
We can use the swagger-json-filter from a js code, givng the input JSON string and options of filtering:
12+
Install package for your project
13+
```shell
14+
npm install swagger-json-filter --save
1315
```
16+
then you can use the swagger-json-filter from a js code, providing the input JSON string and options of filtering:
17+
```javascript
1418
const swaggerJsonFilter = require('swagger-json-filter');
1519
const output = swaggerJsonFilter(inputJsonString, {
1620
includePaths: "^\/estimates\/.*"
@@ -19,17 +23,17 @@ const output = swaggerJsonFilter(inputJsonString, {
1923

2024
### as command line tool
2125
Install package globally
22-
```
26+
```shell
2327
npm install -g swagger-json-filter
2428
```
2529

2630
then you can provide contents of the above JSON file to the stdin:
27-
```
31+
```shell
2832
cat input.json | swagger-json-filter --include-paths="^\/estimates\/.*" > output.json
2933
```
3034

3135
input.json:
32-
```
36+
```json
3337
{
3438
"swagger": "2.0",
3539
"info": {"version": "0.0.0", "title": "Simple API"},
@@ -73,7 +77,7 @@ input.json:
7377
```
7478

7579
and we recive following output.json
76-
```
80+
```json
7781
{
7882
"swagger": "2.0",
7983
"info": {"version": "0.0.0", "title": "Simple API"},

0 commit comments

Comments
 (0)