Skip to content

Commit b91695a

Browse files
committed
Readme updates
1 parent a2a9fc9 commit b91695a

File tree

1 file changed

+61
-35
lines changed

1 file changed

+61
-35
lines changed

README.md

Lines changed: 61 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,28 @@
1-
# Serverless OpenAPI v3 Documentation Plugin
2-
3-
This plugin generates OpenAPI v3 documentation from serverless configuration files. OpenAPI is formerly known as Swagger. The configuration is extends the format specified by [serverless-aws-documentation](https://www.npmjs.com/package/serverless-aws-documentation).
4-
5-
6-
## Install
7-
8-
This plugin works for Serverless 1.x and up. Serverless 0.5 is not supported.
9-
10-
To add this plugin to your package.json:
111

12-
**Using npm:**
13-
```bash
14-
npm install serverless-openapi-documentation --save-dev
15-
```
2+
[![Travis CI](https://img.shields.io/travis/temando/serverless-openapi-documentation.svg)](https://travis-ci.org/temando/serverless-openapi-documentation)
3+
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
164

17-
**Using Yarn:**
18-
```bash
19-
yarn add serverless-openapi-documentation --dev
20-
```
215

22-
Next you need to add the plugin to the `plugins` section of your `serverless.yml` file.
6+
# Serverless OpenAPI v3 Documentation Plugin
237

24-
```yml
25-
plugins:
26-
- serverless-openapi-documentation
27-
```
8+
Generates [**OpenAPI 3.0 RC2**](https://github.com/OAI/OpenAPI-Specification/tree/OpenAPI.next) documentation from serverless configuration files. OpenAPI is formerly known as Swagger. The configuration is inspired by the format used in [serverless-aws-documentation](https://www.npmjs.com/package/serverless-aws-documentation).
289

29-
You can confirm the plugin is correctly installed by running:
10+
---
3011

31-
```bash
32-
serverless | grep "ServerlessOpenAPIDocumentation"
33-
```
12+
- [Usage](#usage)
13+
- [Options](#options)
14+
- [Configuration](#configuration)
15+
- [Models](#models)
16+
- [Functions](#functions)
17+
- [`queryParams`](#queryparams)
18+
- [`pathParams`](#pathparams)
19+
- [`cookieParams`](#cookieparams)
20+
- [`requestModels`](#requestmodels)
21+
- [`methodResponses`](#methodresponses)
22+
- [Example Configuration](#example-configuration)
23+
- [Install](#install)
3424

35-
It should return `ServerlessOpenAPIDocumentation` as one of the plugins on the list.
25+
---
3626

3727
## Usage
3828

@@ -43,7 +33,9 @@ Below are the commandline options to run the generator:
4333
```bash
4434
serverless openapi generate [options]
4535
```
36+
4637
### Options
38+
4739
```bash
4840
Plugin: ServerlessOpenAPIDocumentation
4941
openapi generate ...................... Generate OpenAPI v3 Documentation
@@ -57,7 +49,7 @@ openapi generate ...................... Generate OpenAPI v3 Documentation
5749

5850
To configure this plugin to generate valid OpenAPI documentation there are two places you'll need to modify in your `serverless.yml` file, the `custom` variables section and the `http` event section for each given function in your service.
5951

60-
This plugin is compatible with the same documentation configuration as per [serverless-aws-documentation](https://www.npmjs.com/package/serverless-aws-documentation) and can run beside it.
52+
This plugin is compatible with the same documentation configuration structure in [serverless-aws-documentation](https://www.npmjs.com/package/serverless-aws-documentation) and can run beside it.
6153

6254
The `custom` section of your `serverless.yml` can be configured as below:
6355

@@ -67,18 +59,23 @@ custom:
6759
version: '1'
6860
summary: 'My API'
6961
description: 'This is my API'
62+
models: {}
7063
```
7164
72-
If you find this configuration too verbose, you can separate it out into it's own file, such as `serverless.doc.yml` by replacing it with the following:
65+
These configurations can be quite verbose; you can separate it out into it's own file, such as `serverless.doc.yml` as below:
7366

7467
```yml
7568
custom:
7669
documentation: ${file(serverless.doc.yml):documentation}
70+
71+
functions:
72+
myFunc:
73+
documentation: ${file(serverless.doc.yml):endpoints.myFunc}
7774
```
7875

79-
And instead putting the `documentation` section directly into `serverless.doc.yml`.
76+
For more info on `serverless.yml` syntax, see their docs.
8077

81-
#### Defining models
78+
#### Models
8279

8380
Models contain additional information that you can use to define schemas for endpoints. You must define the *content type* for each schema that you provide in the models.
8481

@@ -114,7 +111,7 @@ custom:
114111
type: "string"
115112
```
116113

117-
### Function event specific documentation
114+
#### Functions
118115

119116
To define the documentation for a given function event, you need to create a `documentation` attribute for your http event in your `serverless.yml` file.
120117

@@ -295,8 +292,37 @@ responseHeaders:
295292

296293
Please view the example [serverless.yml](test/serverless.yml).
297294

298-
## Contribution
299-
`Insert: information on contibution here`
295+
## Install
296+
297+
This plugin works for Serverless 1.x and up. Serverless 0.5 is not supported.
298+
299+
To add this plugin to your package.json:
300+
301+
**Using npm:**
302+
```bash
303+
npm install serverless-openapi-documentation --save-dev
304+
```
305+
306+
**Using Yarn:**
307+
```bash
308+
yarn add serverless-openapi-documentation --dev
309+
```
310+
311+
Next you need to add the plugin to the `plugins` section of your `serverless.yml` file.
312+
313+
```yml
314+
plugins:
315+
- serverless-openapi-documentation
316+
```
317+
318+
You can confirm the plugin is correctly installed by running:
319+
320+
```bash
321+
serverless | grep "ServerlessOpenAPIDocumentation"
322+
```
323+
324+
It should return `ServerlessOpenAPIDocumentation` as one of the plugins on the list.
325+
300326

301327
## License
302328

0 commit comments

Comments
 (0)