Skip to content

Comments

Fix parsing pointers#104

Merged
kubkon merged 3 commits intomainfrom
fix-ptrs
Jul 22, 2025
Merged

Fix parsing pointers#104
kubkon merged 3 commits intomainfrom
fix-ptrs

Conversation

@kubkon
Copy link
Owner

@kubkon kubkon commented Jul 22, 2025

First breaking change is that now Yaml.as* accessor return ?* instead of !*. For example, Yaml.asScalar now returns ?[]const u8. This shifts the responsibility to throw an appropriate error such as error.TypeMismatch to the caller, but simplifies checking for the underlying raw Yaml value.

Next, while plugging in latest nightly zig-yaml into bold, I've run into an issue where trying to parse a simple struct as a list of structs would cause an unexpected panic. Turns out, we outright assumed that when entering parsePointer and expecting a slice we would assume that the underlying raw Yaml value has to be a list which is obviously wrong. This did not surface before as we didn't really have any meaningful support for pointer parsing until recently.

I've now provided a fix and added a smoke test.

kubkon added 3 commits July 22, 2025 21:45
* Yaml.asScalar() -> ?[]const u8,
* Yaml.asList() -> ?List,
* Yaml.asMap() -> ?Map,

as opposed to being fallible and return `error.TypeMismatch`
(this should be thrown by the caller instead).
@kubkon kubkon merged commit 497fca7 into main Jul 22, 2025
10 checks passed
@kubkon kubkon deleted the fix-ptrs branch July 22, 2025 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant