From 5a9553c6e6184dc995328cedf621c736ee4fe135 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 20 Jul 2017 13:26:53 +0200 Subject: [PATCH 1/3] Explained the explicity typing in YAML documents --- components/yaml/yaml_format.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/components/yaml/yaml_format.rst b/components/yaml/yaml_format.rst index 08a76d4c2f8..06ce1b6aff4 100644 --- a/components/yaml/yaml_format.rst +++ b/components/yaml/yaml_format.rst @@ -300,4 +300,25 @@ Comments can be added in YAML by prefixing them with a hash mark (``#``): Comments are simply ignored by the YAML parser and do not need to be indented according to the current level of nesting in a collection. +Explicity Typing +---------------- + +The YAML specification defines some tags to set the type of any data explicitly: + +.. code-block:: yaml + + data: + # this value is parsed as a string (it's not transformed into a DateTime) + start_date: !str 2002-12-14 + + # this value is parsed as a float number (it will be 3.0 instead of 3) + price: !!float 3 + + # this value is parsed as binary data encoded in base64 + picture: !!binary | + R0lGODlhDAAMAIQAAP//9/X + 17unp5WZmZgAAAOfn515eXv + Pz7Y6OjuDg4J+fn5OTk6enp + 56enmleECcgggoBADs= + .. _YAML: http://yaml.org/ From 22f97a2dad31ffcc7c9687916727d8e347f86586 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 20 Jul 2017 14:30:16 +0200 Subject: [PATCH 2/3] Fixed a typo --- components/yaml/yaml_format.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/yaml/yaml_format.rst b/components/yaml/yaml_format.rst index 06ce1b6aff4..b9c5fe61710 100644 --- a/components/yaml/yaml_format.rst +++ b/components/yaml/yaml_format.rst @@ -300,8 +300,8 @@ Comments can be added in YAML by prefixing them with a hash mark (``#``): Comments are simply ignored by the YAML parser and do not need to be indented according to the current level of nesting in a collection. -Explicity Typing ----------------- +Explicit Typing +--------------- The YAML specification defines some tags to set the type of any data explicitly: From 2c55b6017871bcbe322b8ff9881fa3a1fee88ab8 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 31 Jul 2017 10:59:29 +0200 Subject: [PATCH 3/3] Removed the !str tag --- components/yaml/yaml_format.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/components/yaml/yaml_format.rst b/components/yaml/yaml_format.rst index b9c5fe61710..2aab5ee8397 100644 --- a/components/yaml/yaml_format.rst +++ b/components/yaml/yaml_format.rst @@ -308,9 +308,6 @@ The YAML specification defines some tags to set the type of any data explicitly: .. code-block:: yaml data: - # this value is parsed as a string (it's not transformed into a DateTime) - start_date: !str 2002-12-14 - # this value is parsed as a float number (it will be 3.0 instead of 3) price: !!float 3