https://delta.io logo
c

Cole MacKenzie

06/14/2023, 9:38 PM
Is there an additional piece of magic that I am missing or skipping over that enables the serialization/deserialization of
Schema
to and from JSON? Trying it with
serde_yaml
, the non-primitive types
struct
,
array
,
map
become
type: primitive("array")
instead of
type: array(SchemaTypeArray { type: "array", elementType: primitive("integer"), containsNull: true })
Aha, got it. The yaml expects
type
as a yaml map for the complex types.
t

Taylor Beever

06/15/2023, 4:18 PM
Would you mind posting an example or linking some docs? Super interested in being able to define schemas outside of the compiled code!
c

Cole MacKenzie

06/15/2023, 4:24 PM
For larger schemas, the YAML does get messy unfortunately.
t

Taylor Beever

06/15/2023, 4:26 PM
Thanks! Can’t imagine its much messier than a massive
Vec<SchemaField>
though!
c

Cole MacKenzie

06/15/2023, 4:33 PM
You can probably use the YAML anchors
&block
and
<<: *block
to remove a lot of redundancy
and just specify the properties that change
t

Taylor Beever

06/15/2023, 4:59 PM
Yeah anchors are a great idea. Unfortunately, I don’t think they work “between” the
---
so it might be limited but still a valuable strategy.
c

Cole MacKenzie

06/15/2023, 5:00 PM
Oh, I just used
---
to put everything in one page
Think of those as separate files
t

Taylor Beever

06/15/2023, 7:03 PM
Ah right right 👍