Skip to content

Commit f67aaec

Browse files
idubnorik8s-ci-robot
authored andcommitted
Fix - Not applied patch if path contains Uppercase (#330)
* Add JsonPatchTests * Upgrade JsonPatch and Json.net, if netstandard2.0 or netcoreapp2.1
1 parent 8a615c2 commit f67aaec

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

src/KubernetesClient/KubernetesClient.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@
2727
</PropertyGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="1.1.2" />
30+
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="1.1.2" Condition="'$(TargetFramework)' != 'netstandard2.0' and '$(TargetFramework)' != 'netcoreapp2.1'" />
31+
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="3.0.0" Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp2.1'" />
3132
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.138" PrivateAssets="all" />
3233
<PackageReference Include="Portable.BouncyCastle" Version="1.8.1.3" />
3334
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="1.1.2" />
3435
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.10" />
3536
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.6.68" PrivateAssets="all" Condition="'$(MSBuildRuntimeType)' != 'Core'" />
36-
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
37+
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" Condition="'$(TargetFramework)' != 'netstandard2.0' and '$(TargetFramework)' != 'netcoreapp2.1'" />
38+
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp2.1'" />
3739
<PackageReference Include="YamlDotNet" Version="6.0.0" />
3840
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
3941
</ItemGroup>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Linq;
2+
using k8s.Models;
3+
using Microsoft.AspNetCore.JsonPatch;
4+
using Xunit;
5+
6+
namespace k8s.Tests
7+
{
8+
public class JsonPatchTests
9+
{
10+
[Fact]
11+
public void PathContainsUpperCase()
12+
{
13+
var patch = new JsonPatchDocument<V1HorizontalPodAutoscaler>();
14+
patch.Replace(h => h.Spec.MinReplicas, 1);
15+
16+
Assert.Equal("/spec/minReplicas", patch.Operations.Single().path);
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)