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
+15-5Lines changed: 15 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,11 +44,11 @@ To Run: `serverless openapi generate -o openapi.json -f json -a 3.0.3 -p postman
44
44
Options:
45
45
46
46
```
47
-
--output -o What filename the OpenAPI documentation should output under. Default: openapi.json
48
-
--format -f Whether to output the OpenAPI documentation as json or yaml. Default: json
47
+
--output -o What filename the OpenAPI Description should output under. Default: openapi.json
48
+
--format -f Whether to output the OpenAPI Description as json or yaml. Default: json
49
49
--indent -i File indentation in spaces. Default: 2
50
50
--openApiVersion -a OpenAPI version to generate for. Default: 3.0.0
51
-
--postmanCollection -p Will generate a postman collection (from the generated openAPI documentation), in json only, if passed in. Default postman.json
51
+
--postmanCollection -p Will generate a postman collection (from the generated OpenAPI Description), in json only, if passed in. Default postman.json
52
52
--validationWarn -w Warn about validation errors only. Will write the OpenAPI file if generation is successful. Default: false
53
53
```
54
54
@@ -71,6 +71,10 @@ Options:
71
71
- [CORS](#cors)
72
72
- [OWASP Secure Headers](#owasp)
73
73
74
+
#### Validation
75
+
76
+
- [Validation](#validator)
77
+
74
78
### OpenAPI Mapping
75
79
76
80
| OpenAPI field | Serverless field |
@@ -133,7 +137,7 @@ Options:
133
137
134
138
### Configuration
135
139
136
-
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.
140
+
To configure this plugin to generate a valid OpenAPI Description, 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.
137
141
138
142
The `custom` section of your `serverless.yml` can be configured as below:
139
143
@@ -934,6 +938,12 @@ methodResponse:
934
938
935
939
This will set the `Cache-Control` Response Header to have a value of "no-store" rather than any value the OWASP Secure Headers Project recommends.
936
940
941
+
## Validator
942
+
943
+
Validation for the OpenAPI Description is now (as of 0.0.90) done by [Redocly](https://redocly.com/). This is a slightly less opinionated validator for an OpenAPI Description, it should result in less errors around "YAML Anchors". It's also a maintained library, and has support for OpenAPI 3.1.0 which I hope to be able to support very soon.
944
+
945
+
I am making use of https://www.npmjs.com/package/@redocly/openapi-core, which I have been warned is likely to change. If you notice anything going wrong with validation of your OpenAPI Description, feel free to open an issue here. I make active use of this library, so will hopefully come across those issues too.
946
+
937
947
## Example configuration
938
948
939
949
Please view the example [serverless.yml](test/serverless-tests/best/serverless.yml).
@@ -975,7 +985,7 @@ We use the plugin [JSON Schema $Ref Parser](https://apitools.dev/json-schema-ref
975
985
}
976
986
```
977
987
978
-
Where the definition "link" refers to a schema held in a directory that the resolver does not know about, we will not be able to fully resolve the schema which will likely cause errors in validation of the openAPI 3.0.X specification.
988
+
Where the definition "link" refers to a schema held in a directory that the resolver does not know about, we will not be able to fully resolve the schema which will likely cause errors in validation of the OpenAPI 3.0.X Description.
979
989
980
990
Because of the dependency we use to parse externally linked schemas, we can supply our own options to resolve schemas that are more difficult than a straight forward example.
0 commit comments