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

@ievgennaida

Description

@ievgennaida

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 {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions