userver: userver/grpc-protovalidate/validate.hpp File Reference
Loading...
Searching...
No Matches
validate.hpp File Reference

Detailed Description

Coroutine-safe wrappers around protovalidate-cc.

Definition in file validate.hpp.

Go to the source code of this file.

#include <optional>
#include <string>
#include <vector>
#include <google/protobuf/message.h>
#include <grpcpp/support/status.h>
#include <userver/grpc-protovalidate/buf_validate.hpp>
#include <userver/logging/log_helper_fwd.hpp>
+ This graph shows which files directly or indirectly include this file:

Classes

class  grpc_protovalidate::ValidationError
 
class  grpc_protovalidate::ValidationResult
 
struct  grpc_protovalidate::ValidationParams
 

Functions

logging::LogHelpergrpc_protovalidate::operator<< (logging::LogHelper &lh, const ValidationError &error)
 
ValidationResult grpc_protovalidate::ValidateMessage (const google::protobuf::Message &message, const ValidationParams &params={})
 Coroutine-safe wrapper around Validate from protovalidate-cc.
 

Function Documentation

◆ operator<<()

logging::LogHelper & grpc_protovalidate::operator<< ( logging::LogHelper lh,
const ValidationError error 
)

Definition at line 90 of file validate.cpp.

◆ ValidateMessage()

ValidationResult grpc_protovalidate::ValidateMessage ( const google::protobuf::Message &  message,
const ValidationParams params = {} 
)

Coroutine-safe wrapper around Validate from protovalidate-cc.

Returns
std::nullopt if no violations have been found. Using buf::validate::ValidatorFactory is not safe in a coroutine context and may cause crashes. This method uses ThreadLocal to ensure no unexpected coroutine-context switches occur during validation.

Definition at line 116 of file validate.cpp.