You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/migration.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -103,3 +103,46 @@ var model = YamlSerializer.Deserialize(yaml, context.MyType);
103
103
104
104
- Use the syntax APIs (for example [`YamlSyntaxTree`](xref:SharpYaml.Syntax.YamlSyntaxTree)) for lossless roundtrip and source span tooling.
105
105
-[`YamlSerializer`](xref:SharpYaml.YamlSerializer) maps to .NET objects and does not preserve formatting/comments.
106
+
107
+
## SerializerSettings Migration
108
+
109
+
Most `SerializerSettings` switches from v2 were removed because v3 follows the `YamlSerializerOptions`/`YamlSerializerContext` model and aligns with `System.Text.Json` behavior where practical.
110
+
111
+
| v2 setting | v3 equivalent | Notes |
112
+
| --- | --- | --- |
113
+
|`NamingConvention = new CamelCaseNamingConvention()`|`PropertyNamingPolicy = JsonNamingPolicy.CamelCase`| Use `System.Text.Json.JsonNamingPolicy` for CLR property names, and `DictionaryKeyPolicy` for dictionary keys. |
114
+
|`IgnoreUnmatchedProperties = true`| default behavior | SharpYaml v3 skips unmatched YAML members by default, matching `System.Text.Json`. |
115
+
|`IgnoreUnmatchedProperties = false`|`UnmappedMemberHandling = JsonUnmappedMemberHandling.Disallow`| Use the options-level setting or `[JsonUnmappedMemberHandling(JsonUnmappedMemberHandling.Disallow)]` on a specific type to fail on unknown members. |
116
+
|`EmitTags = false`| default behavior | v3 does not emit tags for ordinary object serialization unless they are required for polymorphism or explicitly written by a converter. |
117
+
|`ResetAlias = true`| default behavior | v3 does not preserve object identity unless `ReferenceHandling = YamlReferenceHandling.Preserve` is enabled. Serializer reuse does not carry aliases between operations. |
118
+
119
+
### Unmatched members and extension data
120
+
121
+
If a type has [`YamlExtensionDataAttribute`](xref:SharpYaml.Serialization.YamlExtensionDataAttribute) or [`JsonExtensionDataAttribute`](xref:System.Text.Json.Serialization.JsonExtensionDataAttribute), unmatched YAML members are captured there instead of being rejected.
0 commit comments