Skip to content

Pass a configuration block to the request validation middleware - #514

Merged
ahx merged 1 commit into
mainfrom
request-validation-config-block
Nov 5, 2026
Merged

ahx merged 1 commit into
mainfrom
request-validation-config-block

Conversation

@ahx

@ahx ahx commented Nov 5, 2026

Copy link
Copy Markdown
Owner

use OpenapiFirst::Middlewares::RequestValidation, spec do |config| ... end configures hooks and other options for that middleware only. With a registered name or a Definition, the middleware uses a copy of that OAD whose configuration inherits from it, so the registered OAD stays unchanged.

  • OpenapiFirst.load applies a block given with a Definition or Symbol.
  • Child configurations chain hooks of all ancestors.
  • The middleware uses the request_validation_error_response of the OAD.

`use OpenapiFirst::Middlewares::RequestValidation, spec do |config| ... end`
configures hooks and other options for that middleware only. With a
registered name or a Definition, the middleware uses a copy of that OAD
whose configuration inherits from it, so the registered OAD stays
unchanged.

- `OpenapiFirst.load` applies a block given with a Definition or Symbol.
- Child configurations chain hooks of all ancestors.
- The middleware uses the `request_validation_error_response` of the OAD.
@ahx
ahx merged commit d6bff24 into main Nov 5, 2026
32 checks passed
@ahx
ahx deleted the request-validation-config-block branch November 5, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant