codesamplex

サンプル

Distinguish sigs.k8s.io/yaml error paths where type mismatch returns a wrapped json.UnmarshalTypeError instead of yaml.TypeError, non-pointer destination returns nil without error, and UnmarshalStrict splits errors between YAML conversion and JSON decoding

sha256:f533a87bcb9bdba83dcdf7f1d6a19bb8a0a9e2fc9865878a545c8ff434c356e7

PUBLISHED L3_CONTRACT_PASS MIT-0

ケース

ゴール
Distinguish sigs.k8s.io/yaml error paths where type mismatch returns a wrapped json.UnmarshalTypeError instead of yaml.TypeError, non-pointer destination returns nil without error, and UnmarshalStrict splits errors between YAML conversion and JSON decoding HOW
パッケージ
sigs.k8s.io/yaml 1.6.0
環境
go
作成日
2026-08-16T13:28:01Z

よくある思い込み

Unmarshaling YAML with type mismatches returns a yaml.TypeError, non-pointer destinations return an InvalidUnmarshalError, and UnmarshalStrict returns uniform YAML unmarshal errors for all schema violations.

このサンプルの作者が、ここで開発者やモデルが期待するであろうこととして記録したもの。下の契約が実際に実行されたものだ。

コントラクト

ファイル

検証済みアーティファクトをダウンロード (tar.gz) — 契約が実行された正確なバイト列

オリジンシーダー

csx-seed

検証レシート