Skip to content

Commit

Permalink
Fix hooks usage in Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ahx committed Jun 7, 2024
1 parent 7f09762 commit 4a55347
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,13 @@ Setup per per instance:

```ruby
OpenapiFirst.load('openapi.yaml') do |config|
config.after_request_validation do |request, error, definition|
definition.operation_id
config.after_request_validation do |validated_request|
validated_request.valid? # => true / false
end
config.after_response_validation do |response, error, definition|
config.after_response_validation do |validated_response, request|
if validated_response.invalid?
warn "#{request.request_method} #{request.path}: #{validated_response.error.message}"
end
end
end
```
Expand Down

0 comments on commit 4a55347

Please sign in to comment.