Skip to content

Commit

Permalink
Updated dependencies, removing Newtonsoft.Json, 1.1.0.0 will be a bre…
Browse files Browse the repository at this point in the history
…aking change for some.
  • Loading branch information
RobK410 committed Sep 22, 2024
1 parent 839b229 commit 9ac3914
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 30 deletions.
6 changes: 2 additions & 4 deletions src/Contacts/Address.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@
namespace Talegen.Common.Models.Contacts
{
using System;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Text.Json.Serialization;

/// <summary>
/// Contains an enumerated list of address types.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]

public enum AddressTypes
{
/// <summary>
Expand Down
6 changes: 2 additions & 4 deletions src/Contacts/Email.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
namespace Talegen.Common.Models.Contacts
{
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;


/// <summary>
/// Contains an enumerated list of phone types.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]

public enum EmailTypes
{
/// <summary>
Expand Down
5 changes: 1 addition & 4 deletions src/Contacts/Phone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@
namespace Talegen.Common.Models.Contacts
{
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;


/// <summary>
/// Contains an enumerated list of phone types.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum PhoneTypes
{
/// <summary>
Expand Down
5 changes: 2 additions & 3 deletions src/Extensions/ContactExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ namespace Talegen.Common.Models.Extensions
{
using System;
using System.Security.Claims;
using Newtonsoft.Json;
using Talegen.Common.Models.Contacts;
using Talegen.Common.Models.Extensions.Internal;

Expand Down Expand Up @@ -67,7 +66,7 @@ public static Address ToAddress(this string claimValue)

if (!string.IsNullOrWhiteSpace(claimValue))
{
JwtAddressModel jwtModel = JsonConvert.DeserializeObject<JwtAddressModel>(claimValue);
JwtAddressModel? jwtModel = System.Text.Json.JsonSerializer.Deserialize<JwtAddressModel>(claimValue);

if (jwtModel != null)
{
Expand Down Expand Up @@ -109,7 +108,7 @@ public static Address ToAddress(this string claimValue)
Formatted = address.Formatted
};

result = JsonConvert.SerializeObject(jwtAddressModel);
result = System.Text.Json.JsonSerializer.Serialize(jwtAddressModel);
}

return result;
Expand Down
14 changes: 7 additions & 7 deletions src/Extensions/Internal/JwtAddressModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace Talegen.Common.Models.Extensions.Internal
{
using System;
using Newtonsoft.Json;
using System.Text.Json.Serialization;
using Talegen.Common.Models.Contacts;

/// <summary>
Expand All @@ -34,7 +34,7 @@ internal class JwtAddressModel
/// Gets or sets the Full mailing address, formatted for display or use on a mailing label.This field MAY contain multiple lines, separated by
/// newlines.Newlines can be represented either as a carriage return/line feed pair ("\r\n") or as a single line feed character("\n").
/// </value>
[JsonProperty("formatted")]
[JsonPropertyName("formatted")]
public string Formatted
{
get
Expand Down Expand Up @@ -90,35 +90,35 @@ public string Formatted
/// field MAY contain multiple lines, separated by newlines.Newlines can be represented either as a carriage return/line feed pair ("\r\n") or as a
/// single line feed character("\n").
/// </value>
[JsonProperty("street_address")]
[JsonPropertyName("street_address")]
public string StreetAddress { get; set; }

Check warning on line 94 in src/Extensions/Internal/JwtAddressModel.cs

View workflow job for this annotation

GitHub Actions / nuget prep

Non-nullable property 'StreetAddress' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

/// <summary>
/// Gets or sets the locality.
/// </summary>
/// <value>The City or locality component.</value>
[JsonProperty("locality")]
[JsonPropertyName("locality")]
public string Locality { get; set; }

Check warning on line 101 in src/Extensions/Internal/JwtAddressModel.cs

View workflow job for this annotation

GitHub Actions / nuget prep

Non-nullable property 'Locality' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

/// <summary>
/// Gets or sets the region.
/// </summary>
/// <value>The State, province, prefecture, or region component.</value>
[JsonProperty("region")]
[JsonPropertyName("region")]
public string Region { get; set; }

Check warning on line 108 in src/Extensions/Internal/JwtAddressModel.cs

View workflow job for this annotation

GitHub Actions / nuget prep

Non-nullable property 'Region' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

/// <summary>
/// Gets or sets the postal code.
/// </summary>
/// <value>The Zip code or postal code component.</value>
[JsonProperty("postal_code")]
[JsonPropertyName("postal_code")]
public string PostalCode { get; set; }

Check warning on line 115 in src/Extensions/Internal/JwtAddressModel.cs

View workflow job for this annotation

GitHub Actions / nuget prep

Non-nullable property 'PostalCode' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

/// <summary>
/// Gets or sets the country.
/// </summary>
/// <value>The country name component.</value>
[JsonProperty("country")]
[JsonPropertyName("country")]
public string Country { get; set; }

Check warning on line 122 in src/Extensions/Internal/JwtAddressModel.cs

View workflow job for this annotation

GitHub Actions / nuget prep

Non-nullable property 'Country' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
}
}
5 changes: 1 addition & 4 deletions src/Security/MinimalRoleModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@

namespace Talegen.Common.Models.Security
{
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;


/// <summary>
/// Contains an enumerated list of role types.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum RoleTypes
{
/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions src/Talegen.Common.Models.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<RepositoryUrl>https://github.com/Talegen/Talegen.Common.Models</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>Models</PackageTags>
<PackageReleaseNotes>Updated dependencies.</PackageReleaseNotes>
<PackageReleaseNotes>Updated dependencies. Removing Newtonsoft.Json dependency.</PackageReleaseNotes>
<ApplicationIcon>Assets\logo.ico</ApplicationIcon>
<SignAssembly>false</SignAssembly>
<Version>1.0.15.0</Version>
<Version>1.1.0.0</Version>
<NeutralLanguage>en</NeutralLanguage>
<Nullable>enable</Nullable>
<Title>Talegen.Common.Models</Title>
Expand All @@ -27,9 +27,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="Talegen.Common.Core" Version="1.0.15" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="Talegen.Common.Core" Version="1.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 9ac3914

Please sign in to comment.