Skip to content

Satisfy yaml Marshaler interface on structs with custom Unmarshalers#4213

Merged
justinjc merged 2 commits into
masterfrom
juchan/yaml-marshalers
Mar 29, 2023
Merged

Satisfy yaml Marshaler interface on structs with custom Unmarshalers#4213
justinjc merged 2 commits into
masterfrom
juchan/yaml-marshalers

Conversation

@justinjc
Copy link
Copy Markdown
Collaborator

@justinjc justinjc commented Mar 28, 2023

This implements the Marshaler interface from gopkg.in/yaml.v2 on structs satisfying its Unmarshaler interface.

There are many instances where there are structs that have custom unmarshalers, mostly to convert a string to its underlying numeric enum-like type. Without a corresponding marshaler, a marshaled struct generates invalid yaml that can no longer be unmarshaled and used.

@justinjc justinjc merged commit 15d7fb3 into master Mar 29, 2023
@justinjc justinjc deleted the juchan/yaml-marshalers branch March 29, 2023 01:33
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.

2 participants