Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON-RPC 1.0 support for clients #616

Open
ivan770 opened this issue Mar 7, 2021 · 1 comment · May be fixed by #618
Open

JSON-RPC 1.0 support for clients #616

ivan770 opened this issue Mar 7, 2021 · 1 comment · May be fixed by #618

Comments

@ivan770
Copy link

ivan770 commented Mar 7, 2021

Is it possible for JSON-RPC clients to use 1.0 scheme instead of 2.0? Looks like currently successful and error responses are separate entities, and there is no configuration for Compatibility (like in IoHandler).

/// A type representing all possible values sent from the server to the client.
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
#[serde(untagged)]
pub enum ClientResponse {
/// A regular JSON-RPC request output (single response).
Output(jsonrpc_core::Output),
/// A notification.
Notification(jsonrpc_core::Notification),
}

/// Successful response
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Success {
/// Protocol version
#[serde(skip_serializing_if = "Option::is_none")]
pub jsonrpc: Option<Version>,
/// Result
pub result: Value,
/// Correlation id
pub id: Id,
}
/// Unsuccessful response
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Failure {
/// Protocol Version
#[serde(skip_serializing_if = "Option::is_none")]
pub jsonrpc: Option<Version>,
/// Error
pub error: Error,
/// Correlation id
pub id: Id,
}
/// Represents output - failure or success
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
#[serde(untagged)]
pub enum Output {
/// Success
Success(Success),
/// Failure
Failure(Failure),
}

@niklasad1
Copy link
Member

niklasad1 commented Mar 7, 2021

Is it possible for JSON-RPC clients to use 1.0 scheme instead of 2.0?

No, it's not supported currently.
The RequestBuilder controls the jsonrpc version and it's not possible to configure it to use jsonrpc 1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants