Skip to content

[Yaml] Dumping with no value (like Docker Compose volumes section) isn't supported #58155

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
gremo opened this issue Sep 3, 2024 · 1 comment · Fixed by #58243
Closed

[Yaml] Dumping with no value (like Docker Compose volumes section) isn't supported #58155

gremo opened this issue Sep 3, 2024 · 1 comment · Fixed by #58243

Comments

@gremo
Copy link

gremo commented Sep 3, 2024

Symfony version(s) affected

7.1

Description

There is no way to dump a YAML section "without values".

How to reproduce

Dumping the following "Docker Compose volumes section":

$yaml = Yaml::dump([
  'volumes' => [
    'db-data' => null,
  ],
]);

Will result in:

volumes:
    db-data: null

Using an empty string istead will result in:

volumes:
    db-data: ''

There is actually no way to dump "without value" like:

volumes:
    db-data:

Possible Solution

No response

Additional Context

No response

@xabbuh
Copy link
Member

xabbuh commented Sep 3, 2024

There is technically no difference if null is dumped instead of nothing. I am labeling this as a feature request as being able to dump nothing instead of null should be opt-in through a flag if we were to implement this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment