Skip to content

Commit a5f535f

Browse files
committed
update README with schema changes
1 parent d463c4e commit a5f535f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616

17-
This will generate an OpenAPI V3 (up to v3.0.3) file for you from your serverless file. It can optionally generate a [Postman Collection V2](https://github.com/postmanlabs/openapi-to-postman) from the OpenAPI file for you too.
17+
This will generate an OpenAPI V3 (up to v3.0.3) file for you from your serverless file. It can optionally generate a [Postman Collection V2](https://github.com/postmanlabs/openapi-to-postman) from the OpenAPI file for you too. This currently works for `http` and `httpApi` configurations.
1818

1919
Originally based off of: https://github.com/temando/serverless-openapi-documentation
2020

@@ -131,7 +131,7 @@ Options:
131131

132132
### Configuration
133133

134-
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.
134+
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/httpApi` event section for each given function in your service.
135135

136136
The `custom` section of your `serverless.yml` can be configured as below:
137137

@@ -164,7 +164,7 @@ custom:
164164
models: {}
165165
```
166166

167-
Mostly everything here is optional. A version from a UUID will be generated for you if you don't specify one, title will be the name of your service if you don't specify one.
167+
Mostly everything here is optional. A version from a UUID will be generated for you if you don't specify one, title will be the name of your service if you don't specify one. You will need to specify the `documentation` top object.
168168

169169
#### termsOfService
170170

@@ -483,7 +483,7 @@ functions:
483483

484484
#### Functions
485485

486-
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.
486+
To define the documentation for a given function event, you need to create a `documentation` attribute for your `http` or `httpApi` event in your `serverless.yml` file.
487487

488488
The `documentation` section of the event configuration can contain the following attributes:
489489

@@ -506,6 +506,8 @@ The `documentation` section of the event configuration can contain the following
506506
* `responseHeaders`: a list of response headers (see [responseHeaders](#responseheaders) below)
507507
* `responseModels`: a list of models to describe the request bodies (see [responseModels](#responsemodels) below) for each `Content-Type`
508508

509+
If you don't want a `http` or `httpApi` event to be documented, you can leave off the `documentation` object. The configuration schema will only check that you have specified a `methodResponses` on the `documentation` event, previously the plugin would cause serverless to warn or error (depending on your `configValidationMode`) if you had not supplied a `documentation` on an event.
510+
509511
```yml
510512
functions:
511513
createUser:

0 commit comments

Comments
 (0)