MyO
MyO

Reputation: 443

What does the single period / dot "." in YAML means?

Can any one explain what a single dot (.) means in YAML. Following is the configuration file in YAML:

api_platform:
  resource: .
  type: api_platform
  prefix: /api

The above resource key has a . value.

Upvotes: 4

Views: 5033

Answers (1)

yivi
yivi

Reputation: 47370

A period (.) has no intrinsic meaning on YAML, because nothing has any intrinsic meaning on YAML.

A single period simple means "a string containing .".

Only the application doing the processing can give the YAML contents any meaning. As far as the YAML parser goes, the YAML document is valid or invalid, represents certain structure or not; but that does not imply meaning.

In the context of the Symfony Routing component (the configuration you shows belongs to that component), how that specific period is interpreted it depends on the route loader being used, in this case the api_platform loader.

This route loader, which you can find on api-platform/core/src/Bridge/Symfony/Routing/ApiLoader.php has no use for the resource key. It's not used on the class at all.

So effectively, the period means nothing at all. It is there simply because it's a required configuration key for the Routing component.

Upvotes: 2

Related Questions