Skip to content

Commit 96cdde3

Browse files
committed
Fix YAML writer and update Changelog.
YAML writer was outputting semi-correct alias information after the previous metadata fix, however it wasn't totally accurate. This change ensures with auto resolve any alias values.
1 parent 16cfed1 commit 96cdde3

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
- Nothing yet.
1111

12+
## [v3.1.3] - 2025-12-18
13+
14+
### Fixed
15+
- XML documents no longer create redundant `root` or `item` elements.
16+
- Dasel no longer loses value metadata when reading/writing to internal models.
17+
1218
## [v3.1.2] - 2025-12-17
1319

1420
### Fixed
@@ -721,7 +727,8 @@ See [documentation](https://daseldocs.tomwright.me) for all changes.
721727

722728
- Everything!
723729

724-
[unreleased]: https://github.com/TomWright/dasel/compare/v3.1.2...HEAD
730+
[unreleased]: https://github.com/TomWright/dasel/compare/v3.1.3...HEAD
731+
[v3.1.3]: https://github.com/TomWright/dasel/compare/v3.1.2...v3.1.3
725732
[v3.1.2]: https://github.com/TomWright/dasel/compare/v3.1.1...v3.1.2
726733
[v3.1.1]: https://github.com/TomWright/dasel/compare/v3.1.0...v3.1.1
727734
[v3.1.0]: https://github.com/TomWright/dasel/compare/v3.0.0...v3.1.0

parsing/yaml/yaml_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ list:
183183
name2: *name
184184
`,
185185
out: `name: Tom
186-
name2: *name
186+
name2: Tom
187187
`,
188188
}.run)
189189
}

parsing/yaml/yaml_writer.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,13 @@ func (j *yamlWriter) Write(value *model.Value) ([]byte, error) {
3232
func (yv *yamlValue) ToNode() (*yaml.Node, error) {
3333
res := &yaml.Node{}
3434

35-
yamlAlias, ok := yv.value.Metadata["yaml-alias"].(string)
36-
if ok {
37-
//res.Kind = yaml.ScalarNode
38-
res.Kind = yaml.AliasNode
39-
res.Value = yamlAlias
40-
//res.Alias = &yaml.Node{
41-
// Kind: yaml.ScalarNode,
42-
// Value: yamlAlias,
43-
//}
44-
return res, nil
45-
}
35+
// TODO : Handle yaml aliases.
36+
//yamlAlias, ok := yv.value.Metadata["yaml-alias"].(string)
37+
//if ok {
38+
//res.Kind = yaml.AliasNode
39+
//res.Value = yamlAlias
40+
//return res, nil
41+
//}
4642

4743
switch yv.value.Type() {
4844
case model.TypeString:

0 commit comments

Comments
 (0)