Skip to main content

validate_request_value

Function validate_request_value 

Source
pub fn validate_request_value(
    value: Value,
) -> Result<JsonRpcRequest, ValidationError>
Expand description

Validate a single request Value and convert it into a typed JsonRpcRequest. The caller is responsible for the outer batch-vs-single split and for producing the top-level parse-error response on failing serde_json::from_slice.

Rejects at -32600:

  • root value not an object
  • missing or non-string jsonrpc field
  • jsonrpc value not exactly "2.0"
  • missing or empty method
  • id that is not null, a string, an i64, or a u64 (explicitly rejects fractional, exponent-form, boolean, object, and array ids)
  • params that is not an object, array, or null