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
* doc: Remove Q&A for Upgrade from v2 to v3
The `installSync` method and `synchronous` README section mentioned in
the answer no longer exist in v4.
* doc: Fix Typos in README
* doc: Remove Vestiges of Config Module from NestJS Example
Copy file name to clipboardExpand all lines: README.md
+14-18Lines changed: 14 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -172,7 +172,7 @@ Use express-openapi-validator's OpenAPI `x-eov-operation-*` vendor extensions. S
172
172
173
173
**Here's the gist**
174
174
175
-
- First, specifiy the `operationHandlers` option to set the base directory that contains your operation handler files.
175
+
- First, specify the `operationHandlers` option to set the base directory that contains your operation handler files.
176
176
177
177
```javascript
178
178
app.use(
@@ -205,7 +205,7 @@ app.use(
205
205
206
206
```javascript
207
207
module.exports = {
208
-
// the express handler implementaiton for ping
208
+
// the express handler implementation for ping
209
209
ping: (req, res) => res.status(200).send('pong'),
210
210
};
211
211
```
@@ -275,7 +275,7 @@ module.exports = app;
275
275
# OpenAPI's operationId may be used to to specify the operation id
276
276
operationId: ping
277
277
# x-eov-operation-id may be used to specify the operation id
278
-
# Used when operationId is omiited. Overrides operationId when both are specified
278
+
# Used when operationId is omitted. Overrides operationId when both are specified
279
279
x-eov-operation-id: ping
280
280
# specifies the path to the operation handler.
281
281
# the path is relative to the operationHandlers option
@@ -518,7 +518,7 @@ OpenApiValidator.middleware({
518
518
519
519
### ▪️ apiSpec (required)
520
520
521
-
Specifies the path to an OpenAPI 3 specification or a JSON object representing the OpenAPI 3 specificiation
521
+
Specifies the path to an OpenAPI 3 specification or a JSON object representing the OpenAPI 3 specification
522
522
523
523
```javascript
524
524
apiSpec:'./path/to/my-openapi-spec.yaml';
@@ -600,7 +600,7 @@ Determines whether the validator should validate requests.
600
600
601
601
**removeAdditional:**
602
602
603
-
Determines whether to keep or remove additional properties in request body or to fail validation if schema has `additionalProperties` set to `false`. For futher details, refer to [AJV documentation](https://ajv.js.org/docs/validation.html#removing-additional-properties)
603
+
Determines whether to keep or remove additional properties in request body or to fail validation if schema has `additionalProperties` set to `false`. For further details, refer to [AJV documentation](https://ajv.js.org/docs/validation.html#removing-additional-properties)
604
604
605
605
- `false`(**default**) - not to remove additional properties
606
606
- `"all"`- all additional properties are removed, regardless of additionalProperties keyword in schema (and no validation is made for them).
@@ -683,14 +683,14 @@ Determines whether the validator should validate securities e.g. apikey, basic,
683
683
684
684
Determines whether the validator should validate the OpenAPI specification. Useful if you are certain that the api spec is syntactically correct and want to bypass this check.
685
685
686
-
*Warning:*e certain your spec is valid. And be sure you know what you're doing! express-openapi-validator _*expects*_are valid spec. If incorrect, the validator will behave erradically and/or throw Javascript errors.
686
+
*Warning:*Be certain your spec is valid. And be sure you know what you're doing! express-openapi-validator _*expects*_a valid spec. If incorrect, the validator will behave erratically and/or throw Javascript errors.
687
687
688
688
-`true` (**default**) - validate the OpenAPI specification.
689
689
-`false` - do not validate the OpenAPI specification.
690
690
691
691
### ▪️ formats (optional)
692
692
693
-
Defines a list of custome formats.
693
+
Defines a list of custom formats.
694
694
695
695
-`[{ ... }]` - array of custom format objects. Each object must have the following properties:
696
696
- name: string (required) - the format name
@@ -728,7 +728,7 @@ my_property:
728
728
729
729
Specifies the strictness of validation of string formats.
730
730
731
-
- `"fast"` (**default**) - only validate syntax, but not semantics. E.g. `2010-13-30T23:12:35Z` will pass validation eventhough it contains month 13.
731
+
- `"fast"` (**default**) - only validate syntax, but not semantics. E.g. `2010-13-30T23:12:35Z` will pass validation even though it contains month 13.
732
732
- `"full"`- validate both syntax and semantics. Illegal dates will not pass.
733
733
- `false`- do not validate formats at all.
734
734
@@ -796,7 +796,7 @@ See [mongo-serdes-js](https://github.com/pilerou/mongo-serdes-js) for additional
796
796
797
797
Defines the base directory for operation handlers. This is used in conjunction with express-openapi-validator's OpenAPI vendor extensions, `x-eov-operation-id`, `x-eov-operation-handler` and OpenAPI's `operationId`. See [example](https://github.com/cdimascio/express-openapi-validator/tree/master/examples/3-eov-operations).
798
798
799
-
Additionally, if you want to change how modules are resolved e.g. use dot deliminted operation ids e.g. `path.to.module.myFunction`, you may optionally add a custom `resolver`. See [documentation and example](https://github.com/cdimascio/express-openapi-validator/tree/master/examples/5-custom-operation-resolver)
799
+
Additionally, if you want to change how modules are resolved e.g. use dot delimited operation ids e.g. `path.to.module.myFunction`, you may optionally add a custom `resolver`. See [documentation and example](https://github.com/cdimascio/express-openapi-validator/tree/master/examples/5-custom-operation-resolver)
800
800
801
801
- `string`- the base directory containing operation handlers
802
802
- `false`- (default) disable auto wired operation handlers
@@ -833,7 +833,7 @@ Complete example [here](https://github.com/cdimascio/express-openapi-validator/t
833
833
# OpenAPI's operationId may be used to to specify the operation id
834
834
operationId: ping
835
835
# x-eov-operation-id may be used to specify the operation id
836
-
# Used when operationId is omiited. Overrides operationId when both are specified
836
+
# Used when operationId is omitted. Overrides operationId when both are specified
837
837
x-eov-operation-id: ping
838
838
# specifies the path to the operation handler.
839
839
# the path is relative to the operationHandlers option
@@ -909,7 +909,7 @@ $refParser: {
909
909
910
910
### ▪️ coerceTypes (optional) - _deprecated_
911
911
912
-
Determines whether the validator should coerce value types to match the those defined in the OpenAPI spec. This option applies **only** to path params, query strings, headers, and cookies. _It is **highly unlikley** that will want to disable this. As such this option is deprecated and will be removed in the next major version_
912
+
Determines whether the validator should coerce value types to match the those defined in the OpenAPI spec. This option applies **only** to path params, query strings, headers, and cookies. _It is **highly unlikely** that you will want to disable this. As such this option is deprecated and will be removed in the next major version_
913
913
914
914
-`true` (**default**) - coerce scalar data types.
915
915
-`"array"` - in addition to coercions between scalar types, coerce scalar data to an array with one element and vice versa (as required by the schema).
@@ -939,7 +939,7 @@ In some cases, it may be necessary to _**skip validation** for paths **under the
939
939
940
940
## Security handlers
941
941
942
-
> **Note:** security `handlers` are an optional component. security `handlers` provide a convenience, whereby the request, declared scopes, and the security schema itself are provided as parameters to each security `handlers` callback that you define. The code you write in each callback can then perform authentication and authorization checks. **_Note that the same can be achieved using standard Express middleware_. The difference** is that security `handlers` provide you the OpenAPI schema data described in your specification\_. Ulimately, this means, you don't have to duplicate that information in your code.
942
+
> **Note:** security `handlers` are an optional component. security `handlers` provide a convenience, whereby the request, declared scopes, and the security schema itself are provided as parameters to each security `handlers` callback that you define. The code you write in each callback can then perform authentication and authorization checks. **_Note that the same can be achieved using standard Express middleware_. The difference** is that security `handlers` provide you the OpenAPI schema data described in your specification\_. Ultimately, this means, you don't have to duplicate that information in your code.
943
943
944
944
> All in all, security `handlers` are purely optional and are provided as a convenience.
945
945
@@ -1144,7 +1144,7 @@ module.exports = app;
1144
1144
1145
1145
**A:** OpenAPI 3.0 does not support RFC-6570. That said, we provide a minimalistic mechanism that conforms syntactically to OpenAPI 3 and accomplishes a common use case. For example, matching file paths and storing the matched path in `req.params`
1146
1146
1147
-
Using the following OpenAPI 3.x defintion
1147
+
Using the following OpenAPI 3.x definition
1148
1148
1149
1149
```yaml
1150
1150
/files/{path}*:
@@ -1157,7 +1157,7 @@ Using the following OpenAPI 3.x defintion
1157
1157
type: string
1158
1158
```
1159
1159
1160
-
With the following Express route defintion
1160
+
With the following Express route definition
1161
1161
1162
1162
```javascript
1163
1163
app.get(`/files/:path(*)`, (req, res) => { /* do stuff */ }`
@@ -1194,10 +1194,6 @@ properties:
1194
1194
type: string
1195
1195
```
1196
1196
1197
-
**Q:** I upgraded from from v2 to v3 and validation no longer works. How do I fix it?
1198
-
1199
-
**A**: In version 2.x.x, the `install` method was executed synchronously, in 3.x it's executed asynchronously. To get v2 behavior in v3, use the `installSync` method. See the [synchronous](#synchronous) section for details.
1200
-
1201
1197
**Q:** Can I use `express-openapi-validator` with `swagger-ui-express`?
1202
1198
1203
1199
**A:** Yes. Be sure to `use` the `swagger-ui-express` serve middleware prior to installing `OpenApiValidator`. This will ensure that `swagger-ui-express` is able to fully prepare the spec before before OpenApiValidator attempts to use it. For example:
0 commit comments