Add optional description field to Implementation struct (#649)
* feat: add optional description field to Implementation struct * test: update snapshots
This commit is contained in:
parent
187597bf7e
commit
07028bc0aa
7 changed files with 35 additions and 0 deletions
|
|
@ -841,6 +841,8 @@ pub struct Implementation {
|
||||||
pub title: Option<String>,
|
pub title: Option<String>,
|
||||||
pub version: String,
|
pub version: String,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub description: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub icons: Option<Vec<Icon>>,
|
pub icons: Option<Vec<Icon>>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub website_url: Option<String>,
|
pub website_url: Option<String>,
|
||||||
|
|
@ -858,6 +860,7 @@ impl Implementation {
|
||||||
name: env!("CARGO_CRATE_NAME").to_owned(),
|
name: env!("CARGO_CRATE_NAME").to_owned(),
|
||||||
title: None,
|
title: None,
|
||||||
version: env!("CARGO_PKG_VERSION").to_owned(),
|
version: env!("CARGO_PKG_VERSION").to_owned(),
|
||||||
|
description: None,
|
||||||
icons: None,
|
icons: None,
|
||||||
website_url: None,
|
website_url: None,
|
||||||
}
|
}
|
||||||
|
|
@ -3136,6 +3139,7 @@ mod tests {
|
||||||
name: "test-server".to_string(),
|
name: "test-server".to_string(),
|
||||||
title: Some("Test Server".to_string()),
|
title: Some("Test Server".to_string()),
|
||||||
version: "1.0.0".to_string(),
|
version: "1.0.0".to_string(),
|
||||||
|
description: Some("A test server for unit testing".to_string()),
|
||||||
icons: Some(vec![
|
icons: Some(vec![
|
||||||
Icon {
|
Icon {
|
||||||
src: "https://example.com/icon.png".to_string(),
|
src: "https://example.com/icon.png".to_string(),
|
||||||
|
|
@ -3153,6 +3157,7 @@ mod tests {
|
||||||
|
|
||||||
let json = serde_json::to_value(&implementation).unwrap();
|
let json = serde_json::to_value(&implementation).unwrap();
|
||||||
assert_eq!(json["name"], "test-server");
|
assert_eq!(json["name"], "test-server");
|
||||||
|
assert_eq!(json["description"], "A test server for unit testing");
|
||||||
assert_eq!(json["websiteUrl"], "https://example.com");
|
assert_eq!(json["websiteUrl"], "https://example.com");
|
||||||
assert!(json["icons"].is_array());
|
assert!(json["icons"].is_array());
|
||||||
assert_eq!(json["icons"][0]["src"], "https://example.com/icon.png");
|
assert_eq!(json["icons"][0]["src"], "https://example.com/icon.png");
|
||||||
|
|
@ -3172,6 +3177,7 @@ mod tests {
|
||||||
let implementation: Implementation = serde_json::from_value(old_json).unwrap();
|
let implementation: Implementation = serde_json::from_value(old_json).unwrap();
|
||||||
assert_eq!(implementation.name, "legacy-server");
|
assert_eq!(implementation.name, "legacy-server");
|
||||||
assert_eq!(implementation.version, "0.9.0");
|
assert_eq!(implementation.version, "0.9.0");
|
||||||
|
assert_eq!(implementation.description, None);
|
||||||
assert_eq!(implementation.icons, None);
|
assert_eq!(implementation.icons, None);
|
||||||
assert_eq!(implementation.website_url, None);
|
assert_eq!(implementation.website_url, None);
|
||||||
}
|
}
|
||||||
|
|
@ -3185,6 +3191,7 @@ mod tests {
|
||||||
name: "icon-server".to_string(),
|
name: "icon-server".to_string(),
|
||||||
title: None,
|
title: None,
|
||||||
version: "2.0.0".to_string(),
|
version: "2.0.0".to_string(),
|
||||||
|
description: None,
|
||||||
icons: Some(vec![Icon {
|
icons: Some(vec![Icon {
|
||||||
src: "https://example.com/server.png".to_string(),
|
src: "https://example.com/server.png".to_string(),
|
||||||
mime_type: Some("image/png".to_string()),
|
mime_type: Some("image/png".to_string()),
|
||||||
|
|
|
||||||
|
|
@ -1112,6 +1112,7 @@ async fn test_initialize_request_with_elicitation() {
|
||||||
name: "test-client".to_string(),
|
name: "test-client".to_string(),
|
||||||
version: "1.0.0".to_string(),
|
version: "1.0.0".to_string(),
|
||||||
title: None,
|
title: None,
|
||||||
|
description: None,
|
||||||
website_url: None,
|
website_url: None,
|
||||||
icons: None,
|
icons: None,
|
||||||
},
|
},
|
||||||
|
|
@ -1163,6 +1164,7 @@ async fn test_capability_checking_logic() {
|
||||||
name: "test-client".to_string(),
|
name: "test-client".to_string(),
|
||||||
version: "1.0.0".to_string(),
|
version: "1.0.0".to_string(),
|
||||||
title: None,
|
title: None,
|
||||||
|
description: None,
|
||||||
website_url: None,
|
website_url: None,
|
||||||
icons: None,
|
icons: None,
|
||||||
},
|
},
|
||||||
|
|
@ -1184,6 +1186,7 @@ async fn test_capability_checking_logic() {
|
||||||
name: "test-client".to_string(),
|
name: "test-client".to_string(),
|
||||||
version: "1.0.0".to_string(),
|
version: "1.0.0".to_string(),
|
||||||
title: None,
|
title: None,
|
||||||
|
description: None,
|
||||||
website_url: None,
|
website_url: None,
|
||||||
icons: None,
|
icons: None,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -729,6 +729,12 @@
|
||||||
"Implementation": {
|
"Implementation": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"description": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
"icons": {
|
"icons": {
|
||||||
"type": [
|
"type": [
|
||||||
"array",
|
"array",
|
||||||
|
|
|
||||||
|
|
@ -729,6 +729,12 @@
|
||||||
"Implementation": {
|
"Implementation": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"description": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
"icons": {
|
"icons": {
|
||||||
"type": [
|
"type": [
|
||||||
"array",
|
"array",
|
||||||
|
|
|
||||||
|
|
@ -986,6 +986,12 @@
|
||||||
"Implementation": {
|
"Implementation": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"description": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
"icons": {
|
"icons": {
|
||||||
"type": [
|
"type": [
|
||||||
"array",
|
"array",
|
||||||
|
|
|
||||||
|
|
@ -986,6 +986,12 @@
|
||||||
"Implementation": {
|
"Implementation": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"description": {
|
||||||
|
"type": [
|
||||||
|
"string",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
"icons": {
|
"icons": {
|
||||||
"type": [
|
"type": [
|
||||||
"array",
|
"array",
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ async fn main() -> Result<()> {
|
||||||
name: "test sse client".to_string(),
|
name: "test sse client".to_string(),
|
||||||
title: None,
|
title: None,
|
||||||
version: "0.0.1".to_string(),
|
version: "0.0.1".to_string(),
|
||||||
|
description: None,
|
||||||
website_url: None,
|
website_url: None,
|
||||||
icons: None,
|
icons: None,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue