Skip to content

Commit

Permalink
Revert PR #1513 and #1522, closes #1564, closes #1656
Browse files Browse the repository at this point in the history
  • Loading branch information
Rico Suter committed Dec 8, 2023
1 parent bb1b7ae commit e1a2a79
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 191 deletions.

This file was deleted.

11 changes: 0 additions & 11 deletions src/NJsonSchema.CodeGeneration.CSharp/Models/PropertyModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,6 @@ public PropertyModel(
(_property.ActualTypeSchema.IsDictionary && _settings.GenerateImmutableDictionaryProperties)
)) == false;

/// <summary>Indicates whether or not this property has a <see cref="JsonIgnoreCondition"/>.</summary>
public bool HasJsonIgnoreCondition => JsonIgnoreCondition != null;

/// <summary>Returns the System.Text.Json.Serialization.JsonIgnoreCondition value to be applied to the property.</summary>
public string? JsonIgnoreCondition => _property switch
{
{ IsRequired: false } => "System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault",
{ IsRequired: true } when _settings.RequiredPropertiesMustBeDefined => "System.Text.Json.Serialization.JsonIgnoreCondition.Never",
_ => null
};

/// <summary>Gets the json property required.</summary>
public string JsonPropertyRequiredCode
{
Expand Down
3 changes: 0 additions & 3 deletions src/NJsonSchema.CodeGeneration.CSharp/Templates/Class.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@
{%- endif -%}
{%- if UseSystemTextJson %}
[System.Text.Json.Serialization.JsonPropertyName("{{ property.Name }}")]
{%- if property.HasJsonIgnoreCondition %}
[System.Text.Json.Serialization.JsonIgnore(Condition = {{ property.JsonIgnoreCondition }})]
{%- endif -%}
{%- if property.IsStringEnumArray %}
// TODO(system.text.json): Add string enum item converter
{%- endif -%}
Expand Down

0 comments on commit e1a2a79

Please sign in to comment.