fix: correct numeric types in progress notifications (#361)
* fix: correct numeric types in progress notifications The standard specifies that these may be floating-point. * fix: regenerate schemas
This commit is contained in:
parent
6a97503e29
commit
589815a40e
5 changed files with 16 additions and 22 deletions
|
|
@ -758,10 +758,10 @@ const_string!(ProgressNotificationMethod = "notifications/progress");
|
||||||
pub struct ProgressNotificationParam {
|
pub struct ProgressNotificationParam {
|
||||||
pub progress_token: ProgressToken,
|
pub progress_token: ProgressToken,
|
||||||
/// The progress thus far. This should increase every time progress is made, even if the total is unknown.
|
/// The progress thus far. This should increase every time progress is made, even if the total is unknown.
|
||||||
pub progress: u32,
|
pub progress: f64,
|
||||||
/// Total number of items to process (or total progress required), if known
|
/// Total number of items to process (or total progress required), if known
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub total: Option<u32>,
|
pub total: Option<f64>,
|
||||||
/// An optional message describing the current progress.
|
/// An optional message describing the current progress.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub message: Option<String>,
|
pub message: Option<String>,
|
||||||
|
|
|
||||||
|
|
@ -762,9 +762,8 @@
|
||||||
},
|
},
|
||||||
"progress": {
|
"progress": {
|
||||||
"description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.",
|
"description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.",
|
||||||
"type": "integer",
|
"type": "number",
|
||||||
"format": "uint32",
|
"format": "double"
|
||||||
"minimum": 0
|
|
||||||
},
|
},
|
||||||
"progressToken": {
|
"progressToken": {
|
||||||
"$ref": "#/definitions/ProgressToken"
|
"$ref": "#/definitions/ProgressToken"
|
||||||
|
|
@ -772,11 +771,10 @@
|
||||||
"total": {
|
"total": {
|
||||||
"description": "Total number of items to process (or total progress required), if known",
|
"description": "Total number of items to process (or total progress required), if known",
|
||||||
"type": [
|
"type": [
|
||||||
"integer",
|
"number",
|
||||||
"null"
|
"null"
|
||||||
],
|
],
|
||||||
"format": "uint32",
|
"format": "double"
|
||||||
"minimum": 0
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
|
|
|
||||||
|
|
@ -1027,9 +1027,8 @@
|
||||||
},
|
},
|
||||||
"progress": {
|
"progress": {
|
||||||
"description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.",
|
"description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.",
|
||||||
"type": "integer",
|
"type": "number",
|
||||||
"format": "uint32",
|
"format": "double"
|
||||||
"minimum": 0
|
|
||||||
},
|
},
|
||||||
"progressToken": {
|
"progressToken": {
|
||||||
"$ref": "#/definitions/ProgressToken"
|
"$ref": "#/definitions/ProgressToken"
|
||||||
|
|
@ -1037,11 +1036,10 @@
|
||||||
"total": {
|
"total": {
|
||||||
"description": "Total number of items to process (or total progress required), if known",
|
"description": "Total number of items to process (or total progress required), if known",
|
||||||
"type": [
|
"type": [
|
||||||
"integer",
|
"number",
|
||||||
"null"
|
"null"
|
||||||
],
|
],
|
||||||
"format": "uint32",
|
"format": "double"
|
||||||
"minimum": 0
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
|
|
|
||||||
|
|
@ -1027,9 +1027,8 @@
|
||||||
},
|
},
|
||||||
"progress": {
|
"progress": {
|
||||||
"description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.",
|
"description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.",
|
||||||
"type": "integer",
|
"type": "number",
|
||||||
"format": "uint32",
|
"format": "double"
|
||||||
"minimum": 0
|
|
||||||
},
|
},
|
||||||
"progressToken": {
|
"progressToken": {
|
||||||
"$ref": "#/definitions/ProgressToken"
|
"$ref": "#/definitions/ProgressToken"
|
||||||
|
|
@ -1037,11 +1036,10 @@
|
||||||
"total": {
|
"total": {
|
||||||
"description": "Total number of items to process (or total progress required), if known",
|
"description": "Total number of items to process (or total progress required), if known",
|
||||||
"type": [
|
"type": [
|
||||||
"integer",
|
"number",
|
||||||
"null"
|
"null"
|
||||||
],
|
],
|
||||||
"format": "uint32",
|
"format": "double"
|
||||||
"minimum": 0
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,8 @@ impl MyServer {
|
||||||
let _ = client
|
let _ = client
|
||||||
.notify_progress(ProgressNotificationParam {
|
.notify_progress(ProgressNotificationParam {
|
||||||
progress_token: progress_token.clone(),
|
progress_token: progress_token.clone(),
|
||||||
progress: step,
|
progress: (step as f64),
|
||||||
total: Some(10),
|
total: Some(10.0),
|
||||||
message: Some("Some message".into()),
|
message: Some("Some message".into()),
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue