MergedYamlMapping wipes out comments
Opened this issue · 4 comments
When I use MergedYamlMapping
with overrideConflicts
, the resulting YAML file loses all comments from the original YAML on merge. Without producing an entire example:
final YamlMapping updatedYaml = new MergedYamlMapping(oldYaml, newYaml, true);
System.out.println("OLD------------");
System.out.println(oldYaml.toString());
System.out.println("NEW------------");
System.out.println(newYaml.toString());
System.out.println("UPDATED--------");
System.out.println(updatedYaml.toString());
System.out.println("---------------");
Produces:
[INFO] OLD------------
[INFO] apiVersion: v2
name: Helm Chart Template
description: A Helm chart for Kubernetes
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: 0.0.0
[INFO] NEW------------
[INFO] name: Mock Java Back End Service
description: A mock Java (Quarkus) back end service project used as a sandbox for testing CI processes.
version: "0.0.2-SNAPSHOT"
appVersion: "0.0.2-SNAPSHOT"
[INFO] UPDATED--------
[INFO] apiVersion: v2
name: Mock Java Back End Service
description: A mock Java (Quarkus) back end service project used as a sandbox for testing CI processes.
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
version: "0.0.2-SNAPSHOT"
appVersion: "0.0.2-SNAPSHOT"
[INFO] ---------------
Note how the original has comments while the updated does not. The second you enable overrideConflicts
, all comments are lost in the resulting merge on any item that is overridden.
@robross0606 thank you for reporting this. I'll assign someone to take care of it soon.
Also, is there any way to preserve blank newline spacing when reading or writing the files? The original file has extra newlines between fields, but these appear to be lost on ingestion.
@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role DEV
available or because the project does not have enough funds.
Please, make sure there is at least one available contributor with the required role and the project can afford to pay them.
No, the library does not preserve empty lines as they are not semantically relevant.
We'll look into the comments issue.