Boost C++ Libraries

PrevUpHomeNext

Function template validate_path_args_against_target

boost::taar::handler::validate_path_args_against_target — Cross-check the handler's path_arg providers against the captured target template.

Synopsis

// In header: <boost/taar/handler/path_arg_check.hpp>


template<typename Operand, typename Handler> 
  void validate_path_args_against_target(Operand const & op, 
                                         Handler const & handler);

Description

Runs at handler-registration time. Every name declared by a path_arg (or with_default wrapping one) on handler must appear as a {name} or {*name} placeholder in the template string captured by op's target_constraint. A mismatch – typo, dropped placeholder, or wrong path – throws boost::taar::exception (code errc::invalid_argument, or the template parser's code for a malformed template) with a message naming the offending argument, so the failure surfaces at server startup instead of at the first request.

The check is a no-op when:

  • op's metadata contains no target_constraint (e.g. the matcher only constrains method or headers, or is registered against an MCP envelope), or

  • handler does not satisfy has_path_arg_names (e.g. it's a raw lambda rather than a rest handler).

Path placeholders without a matching path_arg provider are intentionally allowed – a handler may legitimately ignore part of the path.


PrevUpHomeNext