Skip to content

Mention the YAML features not supported by the Yaml component #8249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions components/yaml/yaml_format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@
The YAML Format
===============

According to the official `YAML`_ website, YAML is "a human friendly data
serialization standard for all programming languages".

Even if the YAML format can describe complex nested data structure, this
article only describes the minimum set of features needed to use YAML as a
configuration file format.

YAML is a simple language that describes data. As PHP, it has a syntax for
simple types like strings, booleans, floats, or integers. But unlike PHP, it
makes a difference between arrays (sequences) and hashes (mappings).
According to the official `YAML website`_, YAML is "a human friendly data
serialization standard for all programming languages". The Symfony Yaml
component implements a subset of the `YAML specification`_. Specifically, it
implements the minimum set of features needed to use YAML as a configuration
file format.

Scalars
-------
Expand Down Expand Up @@ -171,8 +166,8 @@ Collections
-----------

A YAML file is rarely used to describe a simple scalar. Most of the time, it
describes a collection. A collection can be a sequence or a mapping of
elements. Both sequences and mappings are converted to PHP arrays.
describes a collection. YAML collections can be a sequence (scalar arrays in PHP)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean by scalar arrays. Perhaps numerically-indexed arrays would be better?

or a mapping of elements (key/value arrays in PHP).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

associative arrays?


Sequences use a dash followed by a space:

Expand Down Expand Up @@ -318,4 +313,20 @@ The YAML specification defines some tags to set the type of any data explicitly:
Pz7Y6OjuDg4J+fn5OTk6enp
56enmleECcgggoBADs=

.. _YAML: http://yaml.org/
Unsupported YAML Features
-------------------------

The following YAML features are not supported by the Symfony Yaml component:

* Structures and multi-documents (``---`` and ``...`` markers);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by structures?

* Complex mapping keys and complex values starting with ``?``;
* Tagged values as keys;
* The following tags and types: `!!set`, `!!omap`, `!!pairs`, `!!set`, `!!seq`,
`!!bool`, `!!int`, `!!merge`, `!!null`, `!!timestamp`, `!!value`, `!!yaml`;
* Global tags (``TAG`` directive; example: ``%TAG ! tag:example.com,2000:app/``)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove globals tags and just keep TAG directive

and global references to a tag (example: ``!<tag:example.com,2000:app/foo>``);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global doesn't feel like the right term... Maybe something like uri-named tags?

* Not having a key in a mapping (example: ``{foo, bar}``; use
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about Using sequence-like syntax for mapping elements?

``{foo: ~, bar: ~}`` instead).

.. _`YAML website`: http://yaml.org/
.. _`YAML specification`: http://www.yaml.org/spec/1.2/spec.html