Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(URGENT) raw: true option should keep strings unescaped in to_xml output #241

Open
andrew2net opened this issue Jan 8, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@andrew2net
Copy link

In the example, description content is parsed correctly, but all tags are escaped in XML output:

class Person < Lutaml::Model::Serializable
  attribute :name, :string
  attribute :description, :string, raw: true
end

> xml = <<~XML
<Person>
  <name>John Doe</name>
  <description>
    A <b>fictional person</b> commonly used as a <i>placeholder name</i>.
  </description>
</Person>
XML

> person = Person.from_xml(xml)
> person.description
"\n  A <b>fictional person</b> commonly used as a <i>placeholder name</i>.\n"

> person.to_xml
<Person>
  <name>John Doe</name>
  <description>
    A &lt;b&gt;fictional person&lt;/b&gt; commonly used as a &lt;i&gt;placeholder name&lt;/i&gt;.
  </description>
</Person>
@andrew2net andrew2net added the bug Something isn't working label Jan 8, 2025
@ronaldtse ronaldtse changed the title Escaped raw string attribute output (URGENT) raw: true option should keep strings unescaped in to_xml output Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants