JSON RPC
JSON-RPC 2.0 library for C++
anonymous_namespace{dispatcher_p.cpp} Namespace Reference

Functions

bool is_valid_request_id (const nlohmann::json &id)
 Checks if the provided JSON value is a valid JSON RPC request ID.
 

Function Documentation

◆ is_valid_request_id()

bool anonymous_namespace{dispatcher_p.cpp}::is_valid_request_id ( const nlohmann::json & id)

Checks if the provided JSON value is a valid JSON RPC request ID.

Parameters
idThe JSON value to check.
Returns
true if the JSON value is a valid request ID, false otherwise.

This function checks if the provided JSON value is a valid JSON RPC request ID. According to the JSON RPC specification, a valid request ID can be a string, a number, or null. Additionally, this function also considers a discarded JSON value as valid.

See also
https://www.jsonrpc.org/specification#request_object

Definition at line 29 of file dispatcher_p.cpp.

30{
31 return id.is_string() || id.is_number() || id.is_null() || id.is_discarded();
32}