docker-compose-viz icon indicating copy to clipboard operation
docker-compose-viz copied to clipboard

YAML anchor throws error

Open burnbabyburn opened this issue 3 years ago • 0 comments

As @Xenira stated in #33 , the project has an issue if compose extension fields are used. invalid example:

x-environment:
  &default-tz-puid-pgid
  TZ: $TZ
  PUID: $PUID
  PGID: $PGID

services:
  service1:
    environment:
      <<: *default-tz-puid-pgid
      Key0: Value0
...

valid example

x-environment:
  &default-tz-puid-pgid
  TZ: $TZ
  PUID: $PUID
  PGID: $PGID

services:
  service1:
    environment:
      <<: &default-tz-puid-pgid
      Key0: Value0
...

The error thrown would be:

In functions.php line 41:

  File "docker-compose.yml" does not contain valid YAML


In Parser.php line 476:

  Unable to parse at line 21 (near "<< * default-tz-puid-pgid").

To me it looks like the filter/search value for the yaml merge is not perfect. If you change <<: *networking-reference to << : &networking-reference no error is thrown but its not a valid yaml/compose-file anymore. So the script is happy with defining a yaml anchor (&) but not using it (*) Further information on using yaml anchor in compose

Seems to be a Symfony error. So it seems we have to wait till docker-compose or symfony adjust.

burnbabyburn avatar Jan 30 '22 19:01 burnbabyburn