goccy / go-yaml

YAML support for the Go language
MIT License
1.12k stars 129 forks source link

Add InterfaceCustomUnmarshaler and test case to override interface type #450

Open ozraru opened 4 months ago

ozraru commented 4 months ago

Close #449

  1. Add CustomInterfaceMarshaler and CustomInterfaceUnmarshaler.

There are Bytes(Un)Marshaler and Interface(Un)Marshaler interface. But there is no Interface(Un)Marshaler in Custom(Un)Marshaler.

I want to use InterfaceUnmashaler as CustomUnmarshaler.

Renaming Custom(Un)marshaler to CustomBytes(Un)marshaler is good for describing function, but it breaks backward compatibility.

The linked issue has a use case and example.

  1. Add test cases to override interface type

Added test case corresponding to the example in the linked issue.

codecov-commenter commented 4 months ago

Codecov Report

Attention: Patch coverage is 89.91597% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 76.26%. Comparing base (4653a1b) to head (fe1b2f9).

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #450 +/- ## ========================================== + Coverage 76.02% 76.26% +0.24% ========================================== Files 13 13 Lines 4692 4790 +98 ========================================== + Hits 3567 3653 +86 - Misses 866 875 +9 - Partials 259 262 +3 ```