Adzz / data_schema

Declarative schemas for data transformations.
Apache License 2.0
86 stars 9 forks source link

Two Way Mappings? Isomorphisms? Round Trips? #10

Closed Adzz closed 2 years ago

Adzz commented 2 years ago

Right now Data Schemas allow for creating a struct from XML for example. What about taking the struct and creating XML from the schema?

This feels possible, but if your schema selects a subset of the XML then obvioulsy if you round tripped you'd lose info.

However the round tripping isn't always neccessary, instead could we define a schema that serializes to XML?

Here casting doesn't make much sense (it will just become strings AFAICT, though casting fns would allow you to transform input data before putting into the XML)

field: {"./Path/To/Node/text()", :map_or_struct_key}
# or 
field: {"./Path/To/Node/text()", :map_or_struct_key, String}