5 ms·
> Unless you have actual type annotations/tags (eg xml, jsonld, graphql), YAML has actual type annotations (tags).
by dragonwriter 6y ago
> Unless you have actual type annotations/tags (eg xml, jsonld, graphql),
YAML has actual type annotations (tags).
- kortex 6y agoWait, really? scrambles to check woah... I've never seen typed yaml, this is wild. negative: !!int -12 zero: !!int 0 positive: !!int 34 Can't say I love the notation, but indeed that is type annotations. I guess neither "yaml type hints" nor "yaml type annotations" are the right query. Had to search explicitly for "yaml tags".
- wowwow 6y agoTypes are !!screaming at reader. Don't want to start blameshitting, but is yaml supposed to be a simple human-readable format?
- kchr 6y agoIt is screaming with double negations!
- PaulDavisThe1st 6y agoIt's not screaming without double negations!!
- Varriount 6y agoThe neat thing is that you can use tags to represent custom data structures or functions. For example, AWS Cloudformation uses YAML tags as a shorthand for template functions [0]. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-base64.html https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGui...
- kanox 6y agoDepending on the parser you can also use them to call arbitrary code. This used to be the default behavior of `pyyaml.load`.