You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+61-35Lines changed: 61 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff 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.
Next you need to add the plugin to the `plugins` section of your `serverless.yml` file.
6
+
# Serverless OpenAPI v3 Documentation Plugin
23
7
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).
28
9
29
-
You can confirm the plugin is correctly installed by running:
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.
59
51
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.
61
53
62
54
The `custom` section of your `serverless.yml` can be configured as below:
63
55
@@ -67,18 +59,23 @@ custom:
67
59
version: '1'
68
60
summary: 'My API'
69
61
description: 'This is my API'
62
+
models: {}
70
63
```
71
64
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:
And instead putting the `documentation` section directly into `serverless.doc.yml`.
76
+
For more info on `serverless.yml` syntax, see their docs.
80
77
81
-
#### Defining models
78
+
#### Models
82
79
83
80
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.
84
81
@@ -114,7 +111,7 @@ custom:
114
111
type: "string"
115
112
```
116
113
117
-
### Function event specific documentation
114
+
#### Functions
118
115
119
116
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.
120
117
@@ -295,8 +292,37 @@ responseHeaders:
295
292
296
293
Please view the example [serverless.yml](test/serverless.yml).
297
294
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.
0 commit comments