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> /// - <https://datatracker.ietf.org/doc/html/rfc7033#section-4.4.1>
/// ///
#[serde(skip_serializing_if = "Option::is_none")]
pub subject: Option<String>, pub subject: Option<String>,
/// Other names the resource described by this document can be referred to. /// 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> /// - <https://datatracker.ietf.org/doc/html/rfc7033#section-4.4.4.2>
/// ///
#[serde(skip_serializing_if = "Option::is_none")]
pub r#type: Option<String>, pub r#type: Option<String>,
/// URI to the resource put in relation. /// 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> /// - <https://datatracker.ietf.org/doc/html/rfc7033#section-4.4.4.3>
/// ///
#[serde(skip_serializing_if = "Option::is_none")]
pub href: Option<String>, pub href: Option<String>,
/// Titles of the resource put in relation in various languages. /// 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> /// - <https://datatracker.ietf.org/doc/html/rfc6415#section-4.2>
/// ///
#[serde(skip_serializing_if = "Option::is_none")]
pub template: Option<String>, pub template: Option<String>,
} }

View file

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