Skip to content
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

Updating nuget package sources #40

Merged
merged 2 commits into from
Sep 19, 2021
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 .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Restore dependencies
run: dotnet restore --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json --source https://api.nuget.org/v3/index.json
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore -p:Version=${VERSION}
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
dotnet-version: '6.0.x'
include-prerelease: true
- name: Install dependencies
run: dotnet restore --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json --source https://api.nuget.org/v3/index.json
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion sample/AspNetCoreMinimal.Entities/Entities.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Text.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using LaDeak.JsonMergePatch.Abstractions;

namespace AspNetCoreMinimal.Entities;
Expand Down
5 changes: 2 additions & 3 deletions sample/AspNetCoreMinimal/AspNetCoreMinimal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.5" />
<PackageReference Include="System.Text.Json" Version="6.0.0-rc.2.21428.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\JsonMergePatch.AspNetCore\JsonMergePatch.AspNetCore.csproj" />
<ProjectReference Include="..\..\src\JsonMergePatch.SourceGenerator\JsonMergePatch.SourceGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\AspNetCoreMinimal.Entities\AspNetCoreMinimal.Entities.csproj" />
</ItemGroup>

Expand Down
24 changes: 10 additions & 14 deletions sample/AspNetCoreMinimal/Controllers/SampleController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using System.Text.Json;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
using AspNetCoreMinimal.Entities;
using LaDeak.JsonMergePatch.Abstractions;
using LaDeak.JsonMergePatch.Http;
Expand All @@ -11,36 +15,28 @@ namespace AspNetCoreMinimal.Controllers;
public class SampleController : ControllerBase
{
private readonly IHttpClientFactory _clientFactory;
private static WeatherForecast _targetWeather = new WeatherForecast() { Date = DateTime.UtcNow, Summary = "Sample weather forecast", TemperatureC = 24 };
private static CitiesData _targetCities = new CitiesData() { Cities = new Dictionary<string, string>() { { "Frankfurt", "Germany" }, { "New York", "US" }, { "London", "UK" } } };

public SampleController(IHttpClientFactory clientFactory)
{
_clientFactory = clientFactory;
}

[HttpGet("Weather")]
public WeatherForecast GetWeather()
{
return new WeatherForecast
{
Date = DateTime.Now.AddDays(1),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = "Sample weather forecast"
};
}
public WeatherForecast GetWeather() => _targetWeather;

[HttpPatch("PatchWeather")]
public WeatherForecast PatchForecast(Patch<WeatherForecast> input)
{
var target = new WeatherForecast() { Date = DateTime.UtcNow, Summary = "Sample weather forecast", TemperatureC = 24 };
var result = input.ApplyPatch(target);
var result = input.ApplyPatch(_targetWeather);
return result;
}

[HttpPatch("PatchCities")]
public CitiesData PatchCities(Patch<CitiesData> input)
{
var target = new CitiesData() { Cities = new Dictionary<string, string>() { { "Frankfurt", "Germany" }, { "New York", "US" }, { "London", "UK" } } };
var result = input.ApplyPatch(target);
var result = input.ApplyPatch(_targetCities);
return result;
}

Expand Down
5 changes: 4 additions & 1 deletion sample/AspNetCoreMinimal/Program.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using System.Text.Json.Serialization;
using LaDeak.JsonMergePatch.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

var builder = WebApplication.CreateBuilder(args);

var mvcBuilder = builder.Services.AddControllers().AddMvcOptions(options =>
{
LaDeak.JsonMergePatch.Abstractions.JsonMergePatchOptions.Repository = LaDeak.JsonMergePatch.Generated.SafeAspNetCoreMinimal.TypeRepository.Instance;
LaDeak.JsonMergePatch.Abstractions.JsonMergePatchOptions.Repository = LaDeak.JsonMergePatch.Generated.SafeAspNetCoreMinimal.Entities.TypeRepository.Instance;
var jsonOptions = new Microsoft.AspNetCore.Http.Json.JsonOptions();
jsonOptions.SerializerOptions.AddContext<SampleJsonContext>();
options.InputFormatters.Insert(0, new JsonMergePatchInputReader(jsonOptions));
Expand Down
2 changes: 1 addition & 1 deletion sample/AspNetCoreWebApi/AspNetCoreWebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ItemGroup>
<!--<PackageReference Include="LaDeak.JsonMergePatch.AspNetCore" Version="0.0.1-alpha1" />
<PackageReference Include="LaDeak.JsonMergePatch.SourceGenerator" Version="0.0.1-alpha1" />-->
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.1" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 5 additions & 1 deletion sample/AspNetCoreWebApi/Controllers/SampleController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
using System.Text.Json;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using LaDeak.JsonMergePatch.Abstractions;
using LaDeak.JsonMergePatch.Http;
using Microsoft.AspNetCore.Mvc;
Expand Down
5 changes: 5 additions & 0 deletions sample/AspNetCoreWebApi/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
using LaDeak.JsonMergePatch.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;

namespace CoreWebApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="6.0.0-rc.2.21428.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\JsonMergePatch.Abstractions\JsonMergePatch.Abstractions.csproj" />
<ProjectReference Include="..\JsonMergePatch.Http\JsonMergePatch.Http.csproj" />
Expand Down
6 changes: 5 additions & 1 deletion src/JsonMergePatch.AspNetCore/JsonMergePatchInputReader.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
using System.Text;
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using LaDeak.JsonMergePatch.Abstractions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Json;
Expand Down
4 changes: 2 additions & 2 deletions src/JsonMergePatch.Http/JsonMergePatch.Http.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="6.0.0-rc.2.21428.1" />
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
<PackageReference Include="System.Text.Json" Version="6.0.0-rc.1.21451.13" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion test/JsonMergePatch.Http.Tests/HttpContentExtensionsTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System.Net.Http.Headers;
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using LaDeak.JsonMergePatch.Abstractions;
using NSubstitute;
using Xunit;
Expand Down
5 changes: 4 additions & 1 deletion test/JsonMergePatch.Tests/JsonMergePatchInputReaderTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Text;
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using LaDeak.JsonMergePatch.Abstractions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Json;
Expand Down