Commit 897b2a3
JSON contract customization (#70435)
* Initial implementation for contract customization
fix build errors
Move converter rooting to DefaultJsonTypeInfoResolver so that it can be used standalone
Fix ConfigurationList.IsReadOnly
Minor refactorings (#1)
* Makes the following changes:
* Move singleton initialization for DefaultTypeInfoResolver behind a static property.
* Consolidate JsonSerializerContext & IJsonTypeInfoResolver values to a single field.
* Move reflection fallback logic away from JsonSerializerContext and into JsonSerializerOptions
* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs
* remove testing of removed field
Simplify the JsonTypeInfo.CreateObject implemenetation (#2)
* Simplify the JsonTypeInfo.CreateObject implemenetation
* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.cs
* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.cs
Co-authored-by: Krzysztof Wicher <mordotymoja@gmail.com>
Co-authored-by: Krzysztof Wicher <mordotymoja@gmail.com>
Tests and fixes for JsonTypeInfoKind.None
TypeInfo type mismatch tests
Allow setting NumberHandling on JsonTypeInfoKind.None
test resolver returning wrong type of options
JsonTypeInfo/JsonPropertyInfo mutability tests
rename test file
Move default converter rooting responsibility behind DefaultJsonTypeInfoResolver (#3)
* Move default converter rooting responsibility behind DefaultJsonTypeInfoResolver
* address feedback
Add simple test for using JsonTypeInfo<T> with APIs directly taking it
fix and tests for untyped/typed CreateObject
uncomment test cases, remove todo
More tests and tiny fixes
Add a JsonTypeInfoResolver.Combine test for JsonSerializerContext (#4)
* Fix JsonTypeInfoResolver.Combine for JsonSerializerContext
* Break up failing test
Fix simple scenarios for combining contexts (#6)
* Fix simple scenarios for combining contexts
* feedback
JsonSerializerContext combine test with different camel casing
Remove unneeded virtual calls & branching when accessing Get & Set delegates (#7)
JsonPropertyInfo tests everything minus ShouldSerialize & NumberHandling
Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs
Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs
throw InvalidOperationException rather than ArgumentNullException for source gen when PropertyInfo.Name is assigned through JsonPropertyInfoValues
tests for duplicated property names and JsonPropertyInfo.NumberHandling
Add tests for NumberHandling and failing tests for ShouldSerialize
disable the failing test and add extra checks
disable remainder of the failing ShouldSerialize tests, fix working one
Fix ShouldSerialize and IgnoreCondition interop
Add failing tests for CreateObject + parametrized constructors
Fix CreateObject support for JsonConstructor types (#10)
* Fix CreateObject support for JsonConstructor types
* address feedback
Make contexts more combinator friendly (#9)
* Make contexts more combinator friendly
* remove converter cache
* redesign test to account for JsonConstructorAttribute
* Combine unit tests
* address feedback
* Add acceptance tests for DataContract attributes & Specified pattern (#11)
* Add private field serialization acceptance test (#13)
* tests, PR feedback (#14)
* PR feedback and extra tests
* Shorten class name, remove incorrect check (not true for polimorphic cases)
* Make parameter matching for custom properties map property Name with parameter (#16)
* Test static initialization with JsonTypeInfo (#17)
* Fix test failures and proper fix this time (#18)
* Fix test failures and proper fix this time
* reinstate ActiveIssueAttribute
* PR feedback and adjust couple of tests which don't set TypeInfoResolver
* fix IAsyncEnumerable tests
* Lock JsonSerializerOptions in JsonTypeInfo.EnsureConfigured()
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>1 parent de078d1 commit 897b2a3
76 files changed
Lines changed: 5865 additions & 927 deletions
File tree
- src/libraries
- System.Text.Json
- gen
- ref
- src
- Resources
- System/Text/Json
- Serialization
- Converters
- Collection
- FSharp
- Object
- Value
- Metadata
- tests
- Common
- System.Text.Json.SourceGeneration.Tests
- System.Text.Json.Tests
- Serialization
- CustomConverterTests
- MetadataTests
- apicompat
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 109 additions & 137 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1473 | 1473 | | |
1474 | 1474 | | |
1475 | 1475 | | |
1476 | | - | |
| 1476 | + | |
1477 | 1477 | | |
1478 | 1478 | | |
1479 | 1479 | | |
1480 | | - | |
| 1480 | + | |
1481 | 1481 | | |
1482 | 1482 | | |
1483 | 1483 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
360 | 367 | | |
361 | 368 | | |
362 | 369 | | |
| |||
950 | 957 | | |
951 | 958 | | |
952 | 959 | | |
953 | | - | |
| 960 | + | |
954 | 961 | | |
955 | 962 | | |
956 | 963 | | |
957 | 964 | | |
958 | 965 | | |
| 966 | + | |
959 | 967 | | |
960 | 968 | | |
961 | 969 | | |
| |||
1044 | 1052 | | |
1045 | 1053 | | |
1046 | 1054 | | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
1047 | 1069 | | |
1048 | 1070 | | |
1049 | 1071 | | |
| |||
1116 | 1138 | | |
1117 | 1139 | | |
1118 | 1140 | | |
| 1141 | + | |
1119 | 1142 | | |
1120 | 1143 | | |
1121 | 1144 | | |
| |||
1138 | 1161 | | |
1139 | 1162 | | |
1140 | 1163 | | |
1141 | | - | |
1142 | 1164 | | |
1143 | 1165 | | |
1144 | 1166 | | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
1145 | 1175 | | |
1146 | 1176 | | |
1147 | 1177 | | |
| |||
1162 | 1192 | | |
1163 | 1193 | | |
1164 | 1194 | | |
1165 | | - | |
1166 | | - | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
1167 | 1200 | | |
1168 | 1201 | | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
1169 | 1216 | | |
1170 | | - | |
1171 | 1217 | | |
1172 | 1218 | | |
1173 | 1219 | | |
| 1220 | + | |
| 1221 | + | |
1174 | 1222 | | |
1175 | 1223 | | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
1176 | 1231 | | |
Lines changed: 57 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
41 | 41 | | |
42 | | - | |
43 | | - | |
44 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
246 | 255 | | |
247 | 256 | | |
248 | 257 | | |
| |||
390 | 399 | | |
391 | 400 | | |
392 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
393 | 408 | | |
394 | 409 | | |
395 | 410 | | |
| |||
572 | 587 | | |
573 | 588 | | |
574 | 589 | | |
575 | | - | |
| 590 | + | |
576 | 591 | | |
577 | 592 | | |
578 | | - | |
| 593 | + | |
579 | 594 | | |
580 | 595 | | |
581 | | - | |
| 596 | + | |
582 | 597 | | |
583 | 598 | | |
584 | 599 | | |
| |||
638 | 653 | | |
639 | 654 | | |
640 | 655 | | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
641 | 668 | | |
0 commit comments