Skip to content

Commit

Permalink
Fix changelog breaking changes notice (#961)
Browse files Browse the repository at this point in the history
The breaking change included in entry (2024-08-31) was not added
correctly. Fix it.
  • Loading branch information
mdmower-csnw authored Sep 2, 2024
1 parent 5b0058d commit 0a8dc2f
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions CHANGE_HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,25 @@

### breaking change

* by defaulting to `true` when not defined by the user.

Add tests:
1. Make sure `AjvOptions` sets the value appropriately based on whether
the end user defined `allErrors` or not.
2. When validating requests, make sure the number of errors reported
(when multiple occur) is 1 when `allErrors` is `false`.

The `allErrors` configuration for OpenAPISchemaValidator is not changed
by this commit since that validation is for trusted content.
By default, request and response validation now stops after the first failure. Only one error will be reported even when multiple may exist. This follows best practices from AJV:
- [Security risks of trusted schemas](https://ajv.js.org/security.html#security-risks-of-trusted-schemas)
- [`allErrors` option](https://ajv.js.org/options.html#allerrors)

To report all validation errors (only recommended in development), option `allErrors` can be set in options `validateRequests` and/or `validateResponses`. For example:

```ts
app.use(
OpenApiValidator.middleware({
apiSpec: 'path/to/openapi.json',
validateRequests: {
allErrors: true,
},
validateResponses: {
allErrors: true,
},
})
);
```


## (2024-08-24)
Expand Down

0 comments on commit 0a8dc2f

Please sign in to comment.