-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Populating JSON properties support (#83669)
* Populating JSON properties support * apply review feedback * Attempt to fix build by reducing stack frame * Fix docs * Remove unnecessary properties from ReadStackFrame. * Move source gen tests to the source gen test project. * Improve test helper method name. * Add argument validation to JsonPropertyInfo.ObjectCreationHandling & extend unit testing for the new metadata APIs. * Add test coverage for invalid attribute annotations. --------- Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
- Loading branch information
1 parent
32ecd85
commit ed9fbe3
Showing
63 changed files
with
7,523 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/libraries/System.Text.Json/Common/JsonObjectCreationHandling.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Text.Json.Serialization | ||
{ | ||
|
||
/// <summary> | ||
/// Determines how deserialization will handle object creation for fields or properties. | ||
/// </summary> | ||
#if BUILDING_SOURCE_GENERATOR | ||
internal | ||
#else | ||
public | ||
#endif | ||
enum JsonObjectCreationHandling | ||
{ | ||
/// <summary> | ||
/// A new instance will always be created when deserializing a field or property. | ||
/// </summary> | ||
Replace = 0, | ||
|
||
/// <summary> | ||
/// Attempt to populate any instances already found on a deserialized field or property. | ||
/// </summary> | ||
Populate = 1, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.