Add wrapper for serde_yaml - #448
Conversation
28a5bca to
ecf8561
Compare
|
Oh, I would have called it Otherwise a more descriptive name might be |
soenkeliebau
left a comment
There was a problem hiding this comment.
Code looks good, ran tests, looks good to me overall.
Not sure I agree with the upstreams change, but it is what it is :)
| @@ -0,0 +1,65 @@ | |||
| //! Wrapper around serde_yaml which adheres to the YAML specification | |||
There was a problem hiding this comment.
I think strictly speaking the --- are only mandatory if the file starts with directives, to delimit these from the actual content of the file.
So arguably serde_yaml adheres to the spec, even though I have to say that I do not agree with the upstream change.
Besides that, it might be worthwhile just adding one sentence about what exactly the difference is between this and serde_yaml to make it easier to understand.
There was a problem hiding this comment.
In YAML 1.0 and 1.1, a YAML stream can start with an "implicit document" (without dashes) or an "explicit document" (with dashes), see https://yaml.org/spec/1.0/index.html#id2561559 and https://yaml.org/spec/1.1/current.html#id898785.
It is the same in YAML 1.2 but "implicit documents" are called "bare documents", see https://yaml.org/spec/1.2.2/#913-bare-documents.
So serde_yaml is compliant with the YAML specification. I will change my pull request.
There was a problem hiding this comment.
Is it worth opening an issue against yamllint for this?
There was a problem hiding this comment.
There is already a closed issue with this topic: adrienverge/yamllint#302
|
Pull request closed in favor of #450 |
Description
serde_yamlwhich adheres to the YAML specification. Operators should use theyamlmodule instead ofserde_yaml.serde_yamlto version0.9.This pull request solves the problem that
serde_yamlin version0.9does not emit leading dashes anymore (see dtolnay/serde-yaml#266) which does not conform to the YAML specification (see https://yaml.org/spec/1.2.2/#22-structures). This becomes especially a problem when concatenating YAMLs which is done in many operators as follows:However, I did not move the concatenation to operator-rs, so it must still be done in the operator:
It can be discussed if this step should also be moved into operator-rs.
According to the usage in the operators (https://github.com/search?l=&q=org%3Astackabletech+%22serde_yaml%3A%3A%22+language%3ARust&type=code), it should be sufficient to forward only
Error,from_str, andto_stringfromserde_yaml.The implementation of
yaml::to_stringcould be improved to use less space but with increased code complexity.Review Checklist
Once the review is done, comment
bors r+(orbors merge) to merge. Further information