In YAML types can be defined both implicitly and explicitly 

Implicit Typing

  • means the data type of your scalar value is going to be automatically inferred based upon the content of your scalar value. 
  • YAML parser recognizes certain patterns and automatically assigned types to value
  • Since this is happening automatically, we can call this typing as implicit typing.

 

 

Explicit Typing

  • Here you may have a requirement to tell to your parser to consider a particular scalar value as a particular data type
  • For Example: trying to mention the scalar as a numerical value, but lets want to convey to the YAML parser to consider it as a string data type.
  • How to achieve this
    • Involve the tags concept to specify the type of a value explicitly. The tag that you are trying to provide to the YAML parser, it is going to consider that data type of the scalar value.
    • Define a tag by using double exclamatory mark

 


Related Question