Commit 6a772bb
committed
Use Committee middleware to validate Chat API responses
This adds a new initializer for Committee that sets up the middleware
to validate the responses from the Chat API against the OpenAPI specification.
It is scoped to the Chat API V0 namespace and is configured to raise
errors if the response does not match the specification so we're alerted
via sentry rather than it failing silently.
I've set strict_reference_validation to true to ensure that our OpenAPI
schema is valid. This will be enforced in the next major release of
Committee.
You can read more about the configuration here:
https://github.com/interagent/committee?tab=readme-ov-file#committeemiddlewareresponsevalidation
I've also added a test to ensure that the middleware is being applied to
the endpoint. We can extract this into a shared example for future endpoints.1 parent 9902fa0 commit 6a772bb
2 files changed
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
55 | 70 | | |
56 | 71 | | |
0 commit comments