Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of tilde character ~ in YAML?

Tags:

yaml

I have looked into YAML official documentation and I have also gone through some tutorials.

I am working with Symfony and I like adding configurations with YAML. But I can't find any explanation for this tilde character ~ in YAML.

For example, see the code below:

firewalls:     # ...     main:         anonymous: ~         http_basic: ~ 

Sometimes, I removed this ~ character and I did not see any effect on logic. So what is the purpose of this tide character in YAML?

like image 773
EresDev Avatar asked Aug 23 '18 16:08

EresDev


People also ask

What does tilde mean in YAML?

The tilde is one of the ways the null value can be written. Most parsers also accept an empty value for null, and of course null , Null and NULL . These are defined in the first two lines of the regular expressions for the core schema tags in the YAML standard.

What hyphen means in YAML?

Items of a list in YAML are represented by preceding it with - (hyphen). Key value pairs in YAML are represented as <key>:<value> . YAML is case sensitive. YAML uses spaces and indentations to define document structure.

What does asterisk mean in YAML?

Anchors. YAML also has a GOTO statement so that the user can define an anchor to reference that value elsewhere. To represent an anchor in YAML code, use the ampersand (&) symbol, followed by the anchor name and an asterisk (*) when referencing that value.

How do I read a YAML file?

YAML is a digestible data serialization language often used to create configuration files with any programming language. Designed for human interaction, YAML is a strict superset of JSON, another data serialization language. But because it's a strict superset, it can do everything that JSON can and more.


1 Answers

The tilde is one of the ways the null value can be written. Most parsers also accept an empty value for null, and of course null, Null and NULL.

These are defined in the first two lines of the regular expressions for the core schema tags in the YAML standard.

like image 103
Anthon Avatar answered Oct 07 '22 05:10

Anthon