feat: support SemanticVersion and SemanticVersionRange as JSON dictionary keys
System.Text.Json requires custom converters to override ReadAsPropertyName/WriteAsPropertyName in order to serialize types used as dictionary keys. Add those overrides to both converters so SemanticVersion and SemanticVersionRange can round trip as Dictionary<TKey,TValue> keys. Add failing-then-passing tests for both key types.
This commit is contained in:
parent
b21bf0568e
commit
27a3dd47f0
5 changed files with 98 additions and 1 deletions
|
|
@ -14,6 +14,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
### Added
|
||||
|
||||
- `SemanticVersion` and `SemanticVersionRange` can now be used as `System.Text.Json`
|
||||
dictionary keys. The custom converters override `ReadAsPropertyName`/`WriteAsPropertyName`
|
||||
so `Dictionary<TKey, TValue>` round-trips correctly.
|
||||
|
||||
### Changed
|
||||
|
||||
- `SemanticVersion` `==`/`Equals`/`GetHashCode` now ignore build metadata, matching precedence comparison rules.
|
||||
|
|
|
|||
Loading…
Reference in a new issue