Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3 unmarshal interface does not support unmarchal object partially. #1046

Open
ievgennaida opened this issue Sep 2, 2024 · 0 comments
Open

Comments

@ievgennaida
Copy link

ievgennaida commented Sep 2, 2024

UnmarshalYaml does not support to decode struct without calling it recursively.

Problem is described here:
https://stackoverflow.com/questions/60636689/custom-unmarshalyaml-interface-for-an-interface-and-its-implementations

Usecase:

  1. Add additional validation when node object is already converted to struct.
  2. Allow to parse and fill struct with multiple of the child properties when most is default yaml interface.
  3. Setting some properties on the final struct when umarshaling is completed.

Decode should not call UnmarshalYaml recursively.
old interface was supporting all those features because unmarshal is not calling UnmarshalYAML

func (m *MyStruct) UnmarshalYAML(unmarshal func(interface{}) error) error {

@ievgennaida ievgennaida changed the title V3 new unmarshal interface does not support unmarchal object partially. V3 unmarshal interface does not support unmarchal object partially. Sep 2, 2024
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

No branches or pull requests

1 participant