Skip to main content

kynos_openapi/model/schema/
xml.rs

1//! The XML Object.
2
3use serde::{Deserialize, Serialize};
4
5use crate::model::extensions::Extensions;
6
7/// Metadata describing the XML representation of a schema.
8///
9/// Kynos does not emit XML today; this exists so that descriptions parsed from
10/// external sources round-trip without loss.
11#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
12pub struct Xml {
13    /// The kind of XML node this schema describes.
14    ///
15    /// Introduced in OpenAPI 3.2, superseding [`attribute`](Xml::attribute) and
16    /// [`wrapped`](Xml::wrapped). One of `element`, `attribute`, `text`,
17    /// `cdata` or `none`.
18    #[cfg(feature = "openapi32")]
19    #[serde(rename = "nodeType", default, skip_serializing_if = "Option::is_none")]
20    pub node_type: Option<String>,
21
22    /// The name of the element or attribute.
23    #[serde(default, skip_serializing_if = "Option::is_none")]
24    pub name: Option<String>,
25
26    /// The URI of the XML namespace.
27    #[serde(default, skip_serializing_if = "Option::is_none")]
28    pub namespace: Option<String>,
29
30    /// The prefix to use for the element name.
31    #[serde(default, skip_serializing_if = "Option::is_none")]
32    pub prefix: Option<String>,
33
34    /// Whether the property becomes an attribute rather than an element.
35    ///
36    /// **Deprecated in OpenAPI 3.2** in favour of `node_type: "attribute"`, and
37    /// must not be combined with it.
38    #[serde(default, skip_serializing_if = "Option::is_none")]
39    pub attribute: Option<bool>,
40
41    /// Whether an array is wrapped in a containing element.
42    ///
43    /// **Deprecated in OpenAPI 3.2** in favour of `node_type: "element"`, and
44    /// must not be combined with it.
45    #[serde(default, skip_serializing_if = "Option::is_none")]
46    pub wrapped: Option<bool>,
47
48    /// Specification extensions.
49    #[serde(flatten)]
50    pub extensions: Extensions,
51}