Skip to content

Commit

Permalink
Update to argon 0.9.0 (#991)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp authored Sep 10, 2023
1 parent 2785b5b commit 35d4401
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 70 deletions.
2 changes: 1 addition & 1 deletion docs/serializer-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ var settings = new JsonSerializerSettings
DefaultValueHandling = DefaultValueHandling.Ignore,
};
```
<sup><a href='/src/Verify/Serialization/SerializationSettings.cs#L81-L90' title='Snippet source file'>snippet source</a> | <a href='#snippet-defaultserialization' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify/Serialization/SerializationSettings.cs#L87-L96' title='Snippet source file'>snippet source</a> | <a href='#snippet-defaultserialization' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
2 changes: 1 addition & 1 deletion src/FSharpTests/FSharpTests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="Tests.fs" />
<PackageReference Include="Argon.FSharp" Version="0.7.2" />
<PackageReference Include="Argon.FSharp" Version="0.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" PrivateAssets="all" />
Expand Down
6 changes: 0 additions & 6 deletions src/Verify/Serialization/Converters/StringBuilderConverter.cs

This file was deleted.

6 changes: 0 additions & 6 deletions src/Verify/Serialization/Converters/StringWriterConverter.cs

This file was deleted.

87 changes: 32 additions & 55 deletions src/Verify/Serialization/SerializationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,40 @@

partial class SerializationSettings
{
static JArrayConverter jArrayConverter = new();
static JObjectConverter jObjectConverter = new();
static KeyValuePairConverter keyValuePairConverter = new();
static InfoBuilder.Converter infoConverter = new();
static SerializationSettings()
{
var converters = DefaultContractResolver.Converters;
converters.Remove(converters.OfType<Argon.KeyValuePairConverter>().Single());
converters.AddRange(new JsonConverter[]
{
new JArrayConverter(),
new JObjectConverter(),
new KeyValuePairConverter(),
new InfoBuilder.Converter(),
#if NET6_0_OR_GREATER
static TimeConverter timeConverter = new();
static DateConverter dateConverter = new();
new TimeConverter(),
new DateConverter(),
#endif
static StringEnumConverter stringEnumConverter = new();
static DelegateConverter delegateConverter = new();
static TargetInvocationExceptionConverter targetInvocationExceptionConverter = new();
static ExpressionConverter expressionConverter = new();
static TypeJsonConverter typeJsonConverter = new();
static MethodInfoConverter methodInfoConverter = new();
static FieldInfoConverter fieldInfoConverter = new();
static ConstructorInfoConverter constructorInfoConverter = new();
static ParameterInfoConverter parameterInfoConverter = new();
static PropertyInfoConverter propertyInfoConverter = new();
static ClaimConverter claimConverter = new();
static AggregateExceptionConverter aggregateExceptionConverter = new();
static ClaimsPrincipalConverter claimsPrincipalConverter = new();
static ClaimsIdentityConverter claimsIdentityConverter = new();
static NameValueCollectionConverter nameValueCollectionConverter = new();
static StringDictionaryConverter stringDictionaryConverter = new();
static StringBuilderConverter stringBuilderConverter = new();
static TaskConverter taskConverter = new();
static ValueTaskConverter valueTaskConverter = new();
static StringWriterConverter stringWriterConverter = new();
new StringEnumConverter(),
new DelegateConverter(),
new TargetInvocationExceptionConverter(),
new ExpressionConverter(),
new TypeJsonConverter(),
new MethodInfoConverter(),
new FieldInfoConverter(),
new ConstructorInfoConverter(),
new ParameterInfoConverter(),
new PropertyInfoConverter(),
new ClaimConverter(),
new AggregateExceptionConverter(),
new ClaimsPrincipalConverter(),
new ClaimsIdentityConverter(),
new NameValueCollectionConverter(),
new StringDictionaryConverter(),
new TaskConverter(),
new ValueTaskConverter(),
});
}

JsonSerializerSettings jsonSettings;

Expand Down Expand Up @@ -92,35 +98,6 @@ JsonSerializerSettings BuildSettings()
settings.SerializationBinder = ShortNameBinder.Instance;

settings.ContractResolver = new CustomContractResolver(this);
var converters = settings.Converters;
converters.Add(aggregateExceptionConverter);
converters.Add(stringBuilderConverter);
converters.Add(infoConverter);
converters.Add(stringWriterConverter);
#if NET6_0_OR_GREATER
converters.Add(dateConverter);
converters.Add(timeConverter);
#endif
converters.Add(stringEnumConverter);
converters.Add(expressionConverter);
converters.Add(delegateConverter);
converters.Add(targetInvocationExceptionConverter);
converters.Add(typeJsonConverter);
converters.Add(methodInfoConverter);
converters.Add(fieldInfoConverter);
converters.Add(constructorInfoConverter);
converters.Add(propertyInfoConverter);
converters.Add(parameterInfoConverter);
converters.Add(claimConverter);
converters.Add(claimsIdentityConverter);
converters.Add(taskConverter);
converters.Add(valueTaskConverter);
converters.Add(claimsPrincipalConverter);
converters.Add(jArrayConverter);
converters.Add(jObjectConverter);
converters.Add(nameValueCollectionConverter);
converters.Add(stringDictionaryConverter);
converters.Add(keyValuePairConverter);
foreach (var extraSetting in extraSettings)
{
extraSetting(settings);
Expand Down
2 changes: 1 addition & 1 deletion src/Verify/Verify.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<PackageReference Include="ConfigureAwait.Fody" Version="3.3.2" PrivateAssets="All" />
<PackageReference Include="Fody" Version="6.8.0" PrivateAssets="All" />
<PackageReference Include="SimpleInfoName" Version="2.1.1" />
<PackageReference Include="Argon" Version="0.7.2" />
<PackageReference Include="Argon" Version="0.9.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" Condition="$(Configuration) == 'Release'" />
<PackageReference Include="ProjectDefaults" Version="1.0.94" PrivateAssets="all" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" Condition="$(TargetFramework.StartsWith('net46'))" />
Expand Down

0 comments on commit 35d4401

Please sign in to comment.