Skip to content

Update YamlDotNet to 8.1.2 #504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/KubernetesClient/KubernetesClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.10" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" Condition="'$(TargetFramework)' != 'netstandard2.0' and '$(TargetFramework)' != 'netcoreapp2.1'" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp2.1'" />
<PackageReference Include="YamlDotNet" Version="6.0.0" />
<PackageReference Include="YamlDotNet" Version="8.1.2" />
<PackageReference Include="System.Buffers" Version="4.5.1" Condition="'$(TargetFramework)' != 'netcoreapp2.1'" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/KubernetesClient/Yaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ public static string SaveToString<T>(T value)
.WithTypeConverter(new IntOrStringYamlConverter())
.WithTypeConverter(new ByteArrayStringYamlConverter())
.WithEventEmitter(e => new StringQuotingEmitter(e))
.ConfigureDefaultValuesHandling(DefaultValuesHandling.OmitNull)
.BuildValueSerializer();
emitter.Emit(new StreamStart());
emitter.Emit(new DocumentStart());
Expand Down
14 changes: 7 additions & 7 deletions tests/KubernetesClient.Tests/YamlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ public void WriteToString()
var pod = new V1Pod() { ApiVersion = "v1", Kind = "Pod", Metadata = new V1ObjectMeta() { Name = "foo" } };

var yaml = Yaml.SaveToString(pod);
Assert.True(ToLines(@"apiVersion: v1
Assert.Equal(ToLines(@"apiVersion: v1
kind: Pod
metadata:
name: foo").SequenceEqual(ToLines(yaml)));
name: foo"), ToLines(yaml));
}

[Fact]
Expand All @@ -131,11 +131,11 @@ public void WriteNamespacedToString()
};

var yaml = Yaml.SaveToString(pod);
Assert.True(ToLines(@"apiVersion: v1
Assert.Equal(ToLines(@"apiVersion: v1
kind: Pod
metadata:
name: foo
namespace: bar").SequenceEqual(ToLines(yaml)));
namespace: bar"), ToLines(yaml));
}

[Fact]
Expand Down Expand Up @@ -170,7 +170,7 @@ public void WritePropertyNamedReadOnlyToString()
};

var yaml = Yaml.SaveToString(pod);
Assert.True(ToLines(@"apiVersion: v1
Assert.Equal(ToLines(@"apiVersion: v1
kind: Pod
metadata:
name: foo
Expand All @@ -184,7 +184,7 @@ public void WritePropertyNamedReadOnlyToString()
readOnly: true
- mountPath: /vm2
name: vm2
readOnly: false").SequenceEqual(ToLines(yaml)));
readOnly: false"), ToLines(yaml));
}

private static IEnumerable<string> ToLines(string s)
Expand Down Expand Up @@ -289,7 +289,7 @@ public void SerializeIntOrString()
};

var output = Yaml.SaveToString<V1Service>(obj);
Assert.True(ToLines(output).SequenceEqual(ToLines(content)));
Assert.Equal(ToLines(output), ToLines(content));
}

[Fact]
Expand Down