Closed alanwilter closed 4 years ago
You will not find anything about this in docker-compose documentation, because Yaml Editor is for any YAML formatted file so it's just about a YAML problem/situation.
Yaml Editor uses internally SnakeYaml and its contained pretty printer - also some additions are made to preserve comments (which are always dropped by SnakeYaml).
At https://bitbucket.org/asomov/snakeyaml/wiki/Howto#markdown-header-to-be-done there is an entry about "Provide example for skipping null and empty collections" - so this should be possible. An example can be found at: https://stackoverflow.com/questions/39745130/filter-out-null-fields-in-snakeyaml
I think https://stackoverflow.com/questions/34089496/empty-field-in-yaml is a good explanation why snake did format this with null.
@alanwilter : In your example above, the db key did not set a value - so value of key "db" is null
. What exactly are you supposing to have after a format when you write this? Skipping null values by snake yaml parser would IMHO result in
volumes:
db:
other:
xyz: 1234
other:
xyz: 1234
so destroys /removes unnecessary parts
I think it is okay to have null
there - it keeps the given structure (so do not remove empty ones).
@alanwilter : Is the explanation good enough for you or do you really need a change here? I think the current behaviour is okay.
Thank @de-jcup !
It's not actually an issue but I can't find anywhere why when use
shift-cmd-F
, to format my yml file, it adds anull
to my Volumes:becomes
I don't see anything about it written in the docker-compose documentation.