サンプル
json_annotation 4.9.0: Configure JsonSerializable options and enum decoding fallbacks in json_annotation, proving snake_case key enforcement, unknownEnumValue null bypass, and readValue error attribution
検証済みサンプル — pub json_annotation 4.9.0: Configure JsonSerializable options and enum decoding fallbacks in json_annotation, proving snake_case key enforcement…
sha256:eabf9843a09e0a2fac2d9fe9f0df3eebd2f3eef2bf42bdd99120e6754d499267
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 2
- ビルドした署名鍵
- 2
宣言された環境
dart linux x64 dart dart pub
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| dart 3 · linux debian/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · pub@1 |
2026-08-17 |
| dart 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · pub@1 |
2026-08-18 |
ケース
HOW- ゴール
- Configure JsonSerializable options and enum decoding fallbacks in json_annotation, proving snake_case key enforcement, unknownEnumValue null bypass, and readValue error attribution
- パッケージ
- シンボル
-
- JsonSerializable
- JsonSerializable.fromJson
- FieldRename
- JsonKey.unknownEnumValue
- JsonKey.nullForUndefinedEnumValue
- JsonKey.readValue
- $enumDecode
- $enumDecodeNullable
- $checkedCreate
- $checkedConvert
- $checkKeys
- CheckedFromJsonException
- UnrecognizedKeysException
- MissingRequiredKeysException
- DisallowedNullValueException
- 環境
- dart
- 作成日
- 2026-08-17T14:38:30Z
コントラクト
- JsonSerializable.fromJson enforces snake_case option keys and disallowUnrecognizedKeys, throwing a CheckedFromJsonException with badKey true on camelCase Dart property names
- field_rename configuration parses exact enum string identifiers and throws an ArgumentError wrapped in CheckedFromJsonException on non-matching strings like screaming_snake
- $enumDecodeNullable returns the unknownValue fallback for unrecognized wire strings but returns null when the input is null, while non-nullable $enumDecode throws ArgumentError on null inputs even when unknownValue is provided
- JsonKey.nullForUndefinedEnumValue causes $enumDecodeNullable to map unrecognized wire strings to null, but passing an incompatible enum type throws an ArgumentError
- readValue custom extractors allow retrieving values from nested paths or aliases, and type mismatch exceptions are re-attributed to the target model field key in CheckedFromJsonException
- $checkKeys evaluates allowedKeys first, requiredKeys second, and disallowNullValues last, where disallowNullValues ignores completely absent keys unless combined with requiredKeys
- $checkedNew attaches the failing key name to CheckedFromJsonException for missing and disallowed-null keys, but leaves key as null for UnrecognizedKeysException
ファイル
- NOTES.md
- csx.json
- lib/account_config.dart
- pubspec.lock
- pubspec.yaml
- test/contract.dart