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
Newline which should exist after comment is not serialized and start of array element is serialized directly after comment. This bug does not occur when there is indent before array element. - name: a #Comment a 3 instead of - name: a #Comment a 3.
Input:
version: 1.0.0## Testservices: # Comment 1# Comment 2
- name: a #Comment a 3extraLabels:
k8s-app: some-app# Comment 4prop: 1
Output:
version: 1.0.0## Testservices: # Comment 1# Comment 2- name: a #Comment a 3extraLabels:
k8s-app: some-app# Comment 4prop: 1
JSON dump of services map key where it can be seen that last element of sep is not newline.
Versions (please complete the following information):
Environment: Node v20.5.0
yaml: 2.3.4
Additional context
Method used to load:
constructor(file: string){constcontents=fs.readFileSync(file).toString()letfoundDocument=undefinedfor(consttokenofnewParser().parse(contents)){this.content.push(token)if(token.type==='document'){foundDocument=token}}if(foundDocument){this.document=foundDocument}else{console.error('Document is empty')process.exit(1)}}
The newline was getting dropped because the - sequence indicator's treatment as whitespace wasn't covered by a detector for comments on empty values in block mappings, because their assignment needs to be adjusted during the parse.
Describe the bug
Newline which should exist after comment is not serialized and start of array element is serialized directly after comment. This bug does not occur when there is indent before array element.
- name: a #Comment a 3
instead of- name: a #Comment a 3
.Input:
Output:
JSON dump of services map key where it can be seen that last element of
sep
is not newline.Expected behaviour
Should keep exact same output.
Versions (please complete the following information):
yaml
: 2.3.4Additional context
Method used to load:
Method to save
The text was updated successfully, but these errors were encountered: