feat: add title field for data types (#410)
* feat(model): add title field to various structs * fix(test): fix test json schema * fix(model): allow boxed type in `ts_union` macro
This commit is contained in:
parent
fdd6bc0565
commit
1b70f5b032
1 changed files with 219 additions and 73 deletions
|
|
@ -11,6 +11,9 @@ pub struct RawResource {
|
|||
pub uri: String,
|
||||
/// Name of the resource
|
||||
pub name: String,
|
||||
/// Human-readable title of the resource
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub title: Option<String>,
|
||||
/// Optional description of the resource
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
|
|
@ -34,6 +37,8 @@ pub struct RawResourceTemplate {
|
|||
pub uri_template: String,
|
||||
pub name: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub title: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub mime_type: Option<String>,
|
||||
|
|
@ -82,6 +87,7 @@ impl RawResource {
|
|||
Self {
|
||||
uri: uri.into(),
|
||||
name: name.into(),
|
||||
title: None,
|
||||
description: None,
|
||||
mime_type: None,
|
||||
size: None,
|
||||
|
|
@ -99,6 +105,7 @@ mod tests {
|
|||
fn test_resource_serialization() {
|
||||
let resource = RawResource {
|
||||
uri: "file:///test.txt".to_string(),
|
||||
title: None,
|
||||
name: "test".to_string(),
|
||||
description: Some("Test resource".to_string()),
|
||||
mime_type: Some("text/plain".to_string()),
|
||||
|
|
|
|||
Loading…
Reference in a new issue