1
Fork 0

hostmeta: Schema improvements

This commit is contained in:
Steffo 2024-11-16 02:55:08 +01:00
parent a5b6485d11
commit 86f9aa27f2
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
2 changed files with 14 additions and 0 deletions

View file

@ -17,6 +17,7 @@ pub struct ResourceDescriptorJRD {
///
/// - <https://datatracker.ietf.org/doc/html/rfc7033#section-4.4.1>
///
#[serde(skip_serializing_if = "Option::is_none")]
pub subject: Option<String>,
/// Other names the resource described by this document can be referred to.
@ -70,6 +71,7 @@ pub struct ResourceDescriptorLinkJRD {
///
/// - <https://datatracker.ietf.org/doc/html/rfc7033#section-4.4.4.2>
///
#[serde(skip_serializing_if = "Option::is_none")]
pub r#type: Option<String>,
/// URI to the resource put in relation.
@ -78,6 +80,7 @@ pub struct ResourceDescriptorLinkJRD {
///
/// - <https://datatracker.ietf.org/doc/html/rfc7033#section-4.4.4.3>
///
#[serde(skip_serializing_if = "Option::is_none")]
pub href: Option<String>,
/// Titles of the resource put in relation in various languages.
@ -104,6 +107,7 @@ pub struct ResourceDescriptorLinkJRD {
///
/// - <https://datatracker.ietf.org/doc/html/rfc6415#section-4.2>
///
#[serde(skip_serializing_if = "Option::is_none")]
pub template: Option<String>,
}

View file

@ -18,6 +18,7 @@ pub struct ResourceDescriptorXRD {
/// - <https://datatracker.ietf.org/doc/html/rfc7033#section-4.4.1>
///
#[serde(rename = "Subject")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subject: Option<String>,
/// Other names the resource described by this document can be referred to.
@ -59,6 +60,7 @@ pub struct ResourceDescriptorXRD {
/// - <https://datatracker.ietf.org/doc/html/rfc6415#section-3.1.1>
///
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename = "Link")]
pub struct ResourceDescriptorLinkXRD {
/// The kind of relation established by the subject with the attached resource.
///
@ -76,6 +78,7 @@ pub struct ResourceDescriptorLinkXRD {
/// - <https://datatracker.ietf.org/doc/html/rfc7033#section-4.4.4.2>
///
#[serde(rename = "@type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub r#type: Option<String>,
/// URI to the resource put in relation.
@ -85,6 +88,7 @@ pub struct ResourceDescriptorLinkXRD {
/// - <https://datatracker.ietf.org/doc/html/rfc7033#section-4.4.4.3>
///
#[serde(rename = "@href")]
#[serde(skip_serializing_if = "Option::is_none")]
pub href: Option<String>,
/// Titles of the resource put in relation in various languages.
@ -94,6 +98,7 @@ pub struct ResourceDescriptorLinkXRD {
/// - <https://datatracker.ietf.org/doc/html/rfc7033#section-4.4.4.4>
///
#[serde(default)]
#[serde(rename = "Title")]
pub titles: Vec<ResourceDescriptorTitleXRD>,
/// Additional information about the resource put in relation.
@ -103,6 +108,7 @@ pub struct ResourceDescriptorLinkXRD {
/// - <https://datatracker.ietf.org/doc/html/rfc7033#section-4.4.4.5>
///
#[serde(default)]
#[serde(rename = "Property")]
pub properties: Vec<ResourceDescriptorPropertyXRD>,
/// Template to fill to get the URL to resource-specific information.
@ -112,6 +118,7 @@ pub struct ResourceDescriptorLinkXRD {
/// - <https://datatracker.ietf.org/doc/html/rfc6415#section-4.2>
///
#[serde(rename = "@template")]
#[serde(skip_serializing_if = "Option::is_none")]
pub template: Option<String>,
}
@ -121,16 +128,19 @@ pub struct ResourceDescriptorLinkXRD {
///
/// - <https://datatracker.ietf.org/doc/html/rfc7033#section-4.4.4.4>
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename = "Title")]
pub struct ResourceDescriptorTitleXRD {
/// The language of the title.
#[serde(rename = "@lang")]
pub language: String,
/// The title itself.
#[serde(rename = "$text")]
pub value: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename = "Property")]
pub struct ResourceDescriptorPropertyXRD {
/// The property identifier, or type.
#[serde(rename = "@rel")]