Comments (9)
@mathstuf I don't think it was questioned whether it works. The relevant function merge_keys_serde simply does not show up in the documentation on docs.rs (feature not enabled), so one has to find it in the source code of your library.
Since this issue comes up in a google search, here's a minimal example:
let value = serde_yaml::from_str(&input_yaml_string).unwrap(); // Value
let merged = yaml_merge_keys::merge_keys_serde(value).unwrap(); // merged Value
let typed_value: T = serde_yaml::from_value(merged).unwrap(); // merged T
from yaml-rust.
I've just published 0.2.1.
from yaml-rust.
FWIW I also needed this and came across https://gitlab.kitware.com/utils/rust-yaml-merge-keys, which adds support for << on top on this library.
Would still love it if it could be supported by yaml-rust by default, though!
from yaml-rust.
Thanks for the pointer. I've tried to make it work (I'm using serde-yaml) but it seems I'm not able to.
Support here would be ideal as it would just work™
from yaml-rust.
yaml-merge-keys
developer here. It supports serde-yaml
using the serde_yaml
feature. We use it in our code just fine.
from yaml-rust.
I looked into it and it now seems possible to specify features for documentation builds. I'll do that for the crate.
from yaml-rust.
Ah, I had done so, but hadn't made a release since then.
from yaml-rust.
There is a spec for this, althouth it is not part of 1.2 itself: https://yaml.org/type/merge.html
from yaml-rust.
I've seen multiple parsers get very loose around the merge key spec. Apparently this is valid for the Ruby parser:
foo:
<<: *bar
<<: *baz
(given anchors named bar
and baz
) but seems like…quite cavalier YAML without the supplemental spec. If you want to apply the merge keys spec, my crate handles that for you and it works with plain yaml-rust
and serde_yaml
. Other YAML libraries can be considered (through feature flags).
from yaml-rust.
Related Issues (20)
- Add support for YAML 1.1 HOT 1
- Support alternate line endings
- Bug in anchor handling? HOT 2
- Panic uninitialised linked hash map HOT 2
- can not part ref HOT 1
- Doesn't seem possible to iteratate over results HOT 3
- misleading? HOT 1
- is it wasm compatible? HOT 1
- Dupliacte keys are not detected as invalid YAML
- Add API to emit YAML strings (i.e. `need_quotes` and `escape_str`)
- tabs are not allowed as the first character of a block scalar
- `Parser` parses empty scalar as '~' HOT 1
- Support no-std with alloc crate
- Integration with google oss-fuzz fuzzing service
- Maintainers HOT 8
- unsafe-libyaml looks... unsafe? HOT 1
- Dynamically choosing a YAML document path? HOT 1
- `True` and `False` boolean literals seem to be parsed as strings HOT 2
- Is this crate maintained? HOT 4
- Read This First ~ Switch to the actively maintained yaml-rust2 fork
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yaml-rust.