You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When converting from TOML to YAML, and using an element value as the content for a head_comment, the output YAML has the first comment removed.
Version of yq: v4.35.2
Operating system: Ubuntu 23.10
Installed via: binary release
Input TOML
sample.toml:
[logging.LOG_LEVEL]
default = "info"go-type = "LogLevel"description = """One of "debug", "info", "warning", "error"."""
[features.FEATURE_FLAG]
default = "false"go-type = "bool"description = """When enabled this will active the feautureYou should take care of the dependent services"""
software:
config:
LOG_LEVEL: info# -- When enabled this will active the feature## You should take care of the dependent servicesFEATURE_FLAG: "false"
Expected behavior
software:
config:
# -- One of "debug", "info", "warning", "error".LOG_LEVEL: info# -- When enabled the feature will be activated# You should take care of configure the dependent servicesFEATURE_FLAG: "false"
Additional context
The LOG_LEVEL head comment was lost. This is the main issue.
I can live with the empty line at the comment, but if you have any tips on how to add an extra #
Maybe out of scope
Another weird thing happened when I removed the last | .[], the comment was split and put into different places.
software:
config:
- LOG_LEVEL: info# You should take care of the dependent services
- FEATURE_FLAG: "false"# -- When enabled this will active the feauture
But that's maybe out os scope for the main issue. I could solve this by removing the empty line from the original TOML, which is not always under my control. So, tell me if I need to open another issue for that.
The text was updated successfully, but these errors were encountered:
The reason the head_comment is removed is because yq has some workarounds on pre-processing headers, you can turn this off by using the "--header-preprocess". Alternatively, you can do this in a single expression like so:
Use reduce to create a new map, based on the children of top level LOG_LEVEL/FEATURE_FLAG map
Go through each of the entries, add the headComment to the key and set the value to be the default
This has actually revealed a bug in the with_entries operator, so I've manually done to_entries / with / from_entries to work around it. I'll fix the with_entries bug for the next release.
Describe the bug
When converting from TOML to YAML, and using an element value as the content for a
head_comment
, the output YAML has the first comment removed.Version of yq: v4.35.2
Operating system: Ubuntu 23.10
Installed via: binary release
Input TOML
sample.toml:
Command
The command you ran:
Actual behavior
Expected behavior
Additional context
The LOG_LEVEL head comment was lost. This is the main issue.
I can live with the empty line at the comment, but if you have any tips on how to add an extra
#
Maybe out of scope
Another weird thing happened when I removed the last
| .[]
, the comment was split and put into different places.But that's maybe out os scope for the main issue. I could solve this by removing the empty line from the original TOML, which is not always under my control. So, tell me if I need to open another issue for that.
The text was updated successfully, but these errors were encountered: