quick-xml icon indicating copy to clipboard operation
quick-xml copied to clipboard

enum text content is (incorrectly) indented

Open torkleyy opened this issue 3 months ago • 1 comments

#[derive(Clone, Debug, Serialize, PartialEq)]
#[serde(rename = "response")]
pub struct Response {
    #[serde(rename = "intent", with = "quick_xml::serde_helpers::text_content")]
    pub intent: Intent,
}

#[derive(Clone, Debug, Serialize, PartialEq)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum Intent {
    Accept,
    Reject,
}

results in

<response>
  <intent>
    ACCEPT
  </intent>
</response>

when indentation is enabled. In my understanding it's incorrect that the element content (intent) contains whitespace.

torkleyy avatar Mar 21 '24 14:03 torkleyy

Yes, I think, this is undesired behavior and we need to fix it

Mingun avatar Mar 21 '24 17:03 Mingun