Altair-Bueno / recast

Transforms one serialization format into another
https://crates.io/crates/recast
MIT License
3 stars 0 forks source link

Two problems #9

Closed jayvdb closed 3 weeks ago

jayvdb commented 1 month ago

Why does the out file say it doesnt exist - of course it doesnt exist ... ;)

> recast --from yaml --to json --out 80c5a4ad-78a0-4a01-83e1-c4145cbf9946.json 80c5a4ad-78a0-4a01-83e1-c4145cbf9946.yaml 
Error: 
   0: No such file or directory (os error 2)

Note: 80c5a4ad-78a0-4a01-83e1-c4145cbf9946.json

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Error mentions both TOML and YAML at the same time?

> recast --from yaml --to json  80c5a4ad-78a0-4a01-83e1-c4145cbf9946.yaml > 80c5a4ad-78a0-4a01-83e1-c4145cbf9946.json
Error: 
   0: foo.bar.baz: invalid type: unit value, expected any valid TOML value at line 14 column 14

Note: cannot deserialize as yaml

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Altair-Bueno commented 3 weeks ago

Why does the out file say it doesnt exist - of course it doesnt exist ... ;)

My bad. Fixed on 223bc72a0021fea026073af5c39e5c9198658333 (master). Please run cargo install --force recast or cargo install --git https://github.com/Altair-Bueno/recast to update

Error mentions both TOML and YAML at the same time?

Internally, recast uses serde_toml::Value, as serde_yaml::Value and serde_json::Value cannot be consistently deserialized into TOML (toml requires key/values to be sorted so subtables appear last). Something similar happens if you try to deserialize null, as TOML doesn't have null values. Haven't found time to write my own Value alternative that solves these issues yet.

jayvdb commented 3 weeks ago

Thank you Altair!