You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the current implementation attempts to parse our yaml into more complex types, with some undesired effects that we can't really control. whereas strictyaml only has strings, arrays and maps.
this means we'll need to do all additional parsing ourselves.
this implementation probably looks something like:
removing ConfigSource and Config entirely
instead, creating a OrderbookYaml and DotrainOrderYaml struct (see the spec)
these will use strictyaml to create a flat struct that matches the structure of the spec (i.e. in a Deployment the order field is a string with the name of the order, not an Order). other types would be parsed (i.e. a Vaultvault-id would be U256.
these structs would be able to take a Vecof yamls that would be merged (i.e. a DotrainOrderYaml could be composed with an OrderbookYaml, like we do now with 'settings' and orders)
implementing setters that will update nested data (i.e. updating a gui deployment's order's first input's token's address)
a serialisation function to convert the DotrainOrderFrontmatter struct back into a string, such that deserialising would produce the same struct
a validation function (?)
the goals for this revised implementation are:
explicit parsing of the yaml into types other than strings
a controlled entrypoint into the data, so for example we can do on the fly token replacement using ${order.input[0].token.address} syntax and know it will be enforced everywhere
one source of truth when working with frontmatters (at the moment having both ConfigSource and Config causes issues where we have to retain both)
always being able to go back to a string without losing any data integrity
other considerations:
strictyaml doesn't contain anchors/refs, so we can't use that functionality as we were thinking. but it was pretty awkward anyway (ie required stringly merging yamls which was getting kinda hacky)
some of this could be done incrementally, for example plots could be re-emitted as a string and parsed using the existing serde_yaml implementation
The text was updated successfully, but these errors were encountered:
as part of #965, we want to switch over to using strictyaml for our dotrain order frontmatter.
https://docs.rs/crate/strict-yaml-rust/latest
the current implementation attempts to parse our yaml into more complex types, with some undesired effects that we can't really control. whereas strictyaml only has strings, arrays and maps.
this means we'll need to do all additional parsing ourselves.
this implementation probably looks something like:
ConfigSource
andConfig
entirelyOrderbookYaml
andDotrainOrderYaml
struct (see the spec)Deployment
theorder
field is a string with the name of the order, not anOrder
). other types would be parsed (i.e. aVault
vault-id
would beU256
.Vec
of yamls that would be merged (i.e. aDotrainOrderYaml
could be composed with anOrderbookYaml
, like we do now with 'settings' and orders)DotrainOrderFrontmatter
struct back into a string, such that deserialising would produce the same structthe goals for this revised implementation are:
${order.input[0].token.address}
syntax and know it will be enforced everywhereConfigSource
andConfig
causes issues where we have to retain both)other considerations:
plots
could be re-emitted as a string and parsed using the existingserde_yaml
implementationThe text was updated successfully, but these errors were encountered: