Skip to content

Commit

Permalink
Merge pull request #7 from syroegkin/dev
Browse files Browse the repository at this point in the history
v 0.1.0
  • Loading branch information
syroegkin authored Aug 15, 2016
2 parents aa54e0f + b1b3d81 commit 77500a0
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 34 deletions.
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,34 @@ swagger-markdown

CLI script to turn swagger yaml into markdown files

see [examples](examples) folder
see [examples](https://github.com/syroegkin/swagger-markdown/tree/master/examples) folder

in development
###Installation

npm install -g swagger-markdown

###Usage
```javascript
swagger-markdown -i path/to/swagger/file.yaml
```
By default it will create the new file within the same directory with the same name as swagger file but with .md extension.
So, if swagger file is placed in `project/api-doc/swagger.yaml` the new file will be created as `project/api-doc/swagger.md`

You can also use it as a npm script in your package.json:

npm i --save-dev swagger-markdown

```json
{
...
scripts: {
...
"md-docs": "swagger-markdown -i path/to/swagger.yaml"
}
}
```

npm run md-docs

***in development***

2 changes: 1 addition & 1 deletion app/transformers/path/parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = parameters => {
res.push('| ---- | ---------- | ----------- | -------- | ---- |');
parameters.map(keys => {
res.push(
`| ${keys.name} | ${keys.in} | ${keys.description} | ` +
`| ${keys.name} | ${keys.in} | ${keys.description.replace(/[\r\n]/g, ' ')} | ` +
`${keys.required ? 'Yes' : 'No'} | ${keys.type} |`
);
});
Expand Down
41 changes: 11 additions & 30 deletions examples/instagram.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,16 +292,10 @@ the last 5 days. Can return mix of image and video types.

| Name | Located in | Description | Required | Type |
| ---- | ---------- | ----------- | -------- | ---- |
| LAT | query | Latitude of the center search coordinate. If used, lng is required.
| No | number |
| MIN_TIMESTAMP | query | A unix timestamp. All media returned will be taken later than
this timestamp.
| No | integer |
| LNG | query | Longitude of the center search coordinate. If used, lat is required.
| No | number |
| MAX_TIMESTAMP | query | A unix timestamp. All media returned will be taken earlier than this
timestamp.
| No | integer |
| LAT | query | Latitude of the center search coordinate. If used, lng is required. | No | number |
| MIN_TIMESTAMP | query | A unix timestamp. All media returned will be taken later than this timestamp. | No | integer |
| LNG | query | Longitude of the center search coordinate. If used, lat is required. | No | number |
| MAX_TIMESTAMP | query | A unix timestamp. All media returned will be taken earlier than this timestamp. | No | integer |
| DISTANCE | query | Default is 1km (distance=1000), max distance is 5km. | No | integer |
**Responses**

Expand Down Expand Up @@ -344,9 +338,7 @@ Can return mix of image and video types.

| Name | Located in | Description | Required | Type |
| ---- | ---------- | ----------- | -------- | ---- |
| TEXT | body | Text to post as a comment on the media object as specified in
media-id.
| No | undefined |
| TEXT | body | Text to post as a comment on the media object as specified in media-id. | No | undefined |
**Responses**

| Code | Description |
Expand Down Expand Up @@ -420,8 +412,7 @@ these objects.

| Name | Located in | Description | Required | Type |
| ---- | ---------- | ----------- | -------- | ---- |
| q | query | A valid tag name without a leading #. (eg. snowy, nofilter)
| No | string |
| q | query | A valid tag name without a leading #. (eg. snowy, nofilter) | No | string |
**Responses**

| Code | Description |
Expand Down Expand Up @@ -465,21 +456,11 @@ these objects.
| Name | Located in | Description | Required | Type |
| ---- | ---------- | ----------- | -------- | ---- |
| distance | query | Default is 1000m (distance=1000), max distance is 5000. | No | integer |
| facebook_places_id | query | Returns a location mapped off of a Facebook places id. If used, a
Foursquare id and lat, lng are not required.
| No | integer |
| foursquare_id | query | returns a location mapped off of a foursquare v1 api location id.
If used, you are not required to use lat and lng. Note that this
method is deprecated; you should use the new foursquare IDs with V2
of their API.
| No | integer |
| lat | query | atitude of the center search coordinate. If used, lng is required.
| No | number |
| lng | query | ongitude of the center search coordinate. If used, lat is required.
| No | number |
| foursquare_v2_id | query | Returns a location mapped off of a foursquare v2 api location id. If
used, you are not required to use lat and lng.
| No | integer |
| facebook_places_id | query | Returns a location mapped off of a Facebook places id. If used, a Foursquare id and lat, lng are not required. | No | integer |
| foursquare_id | query | returns a location mapped off of a foursquare v1 api location id. If used, you are not required to use lat and lng. Note that this method is deprecated; you should use the new foursquare IDs with V2 of their API. | No | integer |
| lat | query | atitude of the center search coordinate. If used, lng is required. | No | number |
| lng | query | ongitude of the center search coordinate. If used, lat is required. | No | number |
| foursquare_v2_id | query | Returns a location mapped off of a foursquare v2 api location id. If used, you are not required to use lat and lng. | No | integer |
**Responses**

| Code | Description |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swagger-markdown",
"version": "0.0.3",
"version": "0.1.0",
"description": "Create markdown API documentation from swagger file",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 77500a0

Please sign in to comment.