Skip to content

Commit e1a2a79

Browse files
author
Rico Suter
committed
Revert PR #1513 and #1522, closes #1564, closes #1656
1 parent bb1b7ae commit e1a2a79

File tree

3 files changed

+0
-191
lines changed

3 files changed

+0
-191
lines changed

src/NJsonSchema.CodeGeneration.CSharp.Tests/JsonIgnoreAttributesTests.cs

-177
This file was deleted.

src/NJsonSchema.CodeGeneration.CSharp/Models/PropertyModel.cs

-11
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,6 @@ public PropertyModel(
6666
(_property.ActualTypeSchema.IsDictionary && _settings.GenerateImmutableDictionaryProperties)
6767
)) == false;
6868

69-
/// <summary>Indicates whether or not this property has a <see cref="JsonIgnoreCondition"/>.</summary>
70-
public bool HasJsonIgnoreCondition => JsonIgnoreCondition != null;
71-
72-
/// <summary>Returns the System.Text.Json.Serialization.JsonIgnoreCondition value to be applied to the property.</summary>
73-
public string? JsonIgnoreCondition => _property switch
74-
{
75-
{ IsRequired: false } => "System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault",
76-
{ IsRequired: true } when _settings.RequiredPropertiesMustBeDefined => "System.Text.Json.Serialization.JsonIgnoreCondition.Never",
77-
_ => null
78-
};
79-
8069
/// <summary>Gets the json property required.</summary>
8170
public string JsonPropertyRequiredCode
8271
{

src/NJsonSchema.CodeGeneration.CSharp/Templates/Class.liquid

-3
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@
5353
{%- endif -%}
5454
{%- if UseSystemTextJson %}
5555
[System.Text.Json.Serialization.JsonPropertyName("{{ property.Name }}")]
56-
{%- if property.HasJsonIgnoreCondition %}
57-
[System.Text.Json.Serialization.JsonIgnore(Condition = {{ property.JsonIgnoreCondition }})]
58-
{%- endif -%}
5956
{%- if property.IsStringEnumArray %}
6057
// TODO(system.text.json): Add string enum item converter
6158
{%- endif -%}

0 commit comments

Comments
 (0)