Skip to main content

initialize_params_for_version

Function initialize_params_for_version 

Source
pub fn initialize_params_for_version(
    params: &Value,
    selected: ProtocolVersion,
) -> Result<Map<String, Value>, Error>
Expand description

Rewrite the params of an initialize request for the protocol version selected that a version-agnostic forwarder, such as the conductor, selected for it.

The SDK’s own agents negotiate the same way. A request for a newer version than selected was written for that newer version, so it keeps only what parses under selected instead of being rejected (for v1, only the shared capabilities are carried across). A request for selected or an older version keeps its params. In every case protocolVersion is set to selected.

§Errors

Returns -32602 when params has no valid protocolVersion, and -32600 when a newer request must be rewritten for a version this build of the SDK does not support.