YAMLの真偽値の扱いに注意。
実はYAMLには型があります。
a: 123 # an integer
b: "123" # a string, disambiguated by quotes
c: 123.0 # a float
d: !!float 123 # also a float via explicit data type prefixed by (!!)
e: !!str 123 # a string, disambiguated by explicit type
f: !!str Yes # a string via explicit type
g: Yes # a boolean True
h: Yes we have No bananas # a string, "Yes" and "No" disambiguated by context.
123や"123"をinteger, stringと扱うのは普段Ruby等を使用されている方は見慣れてると思いますが、
Yesは boolean の扱いをされる点に注目。(Objective-Cな人は見慣れてますかね)
それが何か問題になるの?
YAMLパーサーの中にはキーにYes(yesも)を利用すると、"true":
という様に キー名を変換してしまう パーサーもあるので、命名に注意しないといけません。
こんな感じで
Author And Source
この問題について(YAMLの真偽値の扱いに注意。), 我々は、より多くの情報をここで見つけました https://qiita.com/camelmasa/items/a5be5ed7c514ce89e1e1著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .