Skip to content

Commit

Permalink
Update YamlDotNet to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
AB-xdev committed Oct 25, 2024
1 parent 478ac3c commit 987acc8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.0.3
* Update ``YamlDotNet`` to latest version

# 1.0.2
* Fix ``arm64`` build

Expand Down
2 changes: 1 addition & 1 deletion src/OpenIdConnectServerMock.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="8.0.10" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="YamlDotNet" Version="15.3.0" />
<PackageReference Include="YamlDotNet" Version="16.1.3" />
</ItemGroup>

</Project>
10 changes: 3 additions & 7 deletions src/YamlConverters/ClaimYamlConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,14 @@ public bool Accepts(Type type)
return type == typeof(Claim);
}

#nullable enable
public void WriteYaml(IEmitter emitter, object? value, Type type)
public void WriteYaml(IEmitter emitter, object? value, Type type, ObjectSerializer rootSerializer)
{
throw new NotSupportedException();
}
#nullable disable


public object ReadYaml(IParser parser, Type type)
public object ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer)
{
if (parser.Current.GetType() != typeof(MappingStart)) // You could also use parser.Accept<MappingStart>()
if (parser.Current?.GetType() != typeof(MappingStart)) // You could also use parser.Accept<MappingStart>()
{
throw new InvalidDataException("Invalid YAML content.");
}
Expand Down Expand Up @@ -56,6 +53,5 @@ public object ReadYaml(IParser parser, Type type)
if (string.IsNullOrEmpty(claimValueType)) claimValueType = ClaimValueTypes.String;
return new Claim(claimType, claimValue, claimValueType);
}

}
}
4 changes: 2 additions & 2 deletions src/YamlConverters/SecretYamlConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ public bool Accepts(Type type)
return type == typeof(Secret);
}

public void WriteYaml(IEmitter emitter, object value, Type type)
public void WriteYaml(IEmitter emitter, object? value, Type type, ObjectSerializer rootSerializer)
{
throw new NotSupportedException();
}

public object ReadYaml(IParser parser, Type type)
public object ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer)
{
string s = parser.Consume<Scalar>().Value;
return new Secret(s.Sha256());
Expand Down

0 comments on commit 987acc8

Please sign in to comment.