Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant