Skip to content

Commit a61d571

Browse files
committed
review feedback
1 parent 204bcf9 commit a61d571

File tree

10 files changed

+37
-42
lines changed

10 files changed

+37
-42
lines changed

Build.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,14 @@ function CreateNuGetPackage {
9393
CheckLastExitCode
9494
}
9595

96-
function LoadBaseBranchIfNotMaster(){
97-
if ($env:APPVEYOR_REPO_BRANCH -ne "master") {
98-
git fetch origin ${env:APPVEYOR_REPO_BRANCH}:${env:APPVEYOR_REPO_BRANCH}
96+
# In a PR the base branch needs to be fetched in order for regitlint to work.
97+
function FetchBaseBranchIfNotMaster(){
98+
if ($env:APPVEYOR_PULL_REQUEST_NUMBER -And $env:APPVEYOR_REPO_BRANCH -ne "master"){
99+
git fetch -q origin ${env:APPVEYOR_REPO_BRANCH}:${env:APPVEYOR_REPO_BRANCH}
99100
}
100101
}
101102

102-
LoadBaseBranchIfNotMaster
103+
FetchBaseBranchIfNotMaster
103104

104105
dotnet tool restore
105106
CheckLastExitCode

src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
</PropertyGroup>
55

66
<ItemGroup>
7+
<ProjectReference Include="..\..\JsonApiDotNetCore.OpenApi\JsonApiDotNetCore.OpenApi.csproj" />
78
<ProjectReference Include="..\..\JsonApiDotNetCore\JsonApiDotNetCore.csproj" />
89
</ItemGroup>
910

src/Examples/JsonApiDotNetCoreExample/Program.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using JsonApiDotNetCoreExample.Startups;
21
using Microsoft.AspNetCore.Hosting;
32
using Microsoft.Extensions.Hosting;
43

src/Examples/JsonApiDotNetCoreExample/Startups/Startup.cs renamed to src/Examples/JsonApiDotNetCoreExample/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
using Newtonsoft.Json;
1313
using Newtonsoft.Json.Converters;
1414

15-
namespace JsonApiDotNetCoreExample.Startups
15+
namespace JsonApiDotNetCoreExample
1616
{
1717
public sealed class Startup
1818
{

src/JsonApiDotNetCore.OpenApi/JsonApiDotNetCore.OpenApi.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<PackageReference Include="Swashbuckle.AspNetCore" Version="$(SwashbuckleVersion)" />
1212
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="$(SwashbuckleVersion)" />
1313
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="$(SwashbuckleVersion)" />
14+
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="$(SwashbuckleVersion)" />
1415
</ItemGroup>
1516
</Project>

src/JsonApiDotNetCore.OpenApi/ServiceCollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace JsonApiDotNetCore.OpenApi
66
{
77
public static class ServiceCollectionExtensions
88
{
9-
public static void AddOpenApi(this IServiceCollection services, IMvcCoreBuilder builder, Action<SwaggerGenOptions> setupSwaggerGenAction)
9+
public static void AddOpenApi(this IServiceCollection services, IMvcCoreBuilder builder, Action<SwaggerGenOptions> setupSwaggerGenAction = null)
1010
{
1111
ArgumentGuard.NotNull(services, nameof(services));
1212
ArgumentGuard.NotNull(builder, nameof(builder));

test/OpenApiTests/AirplanesController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace OpenApiTests
77
{
88
public sealed class AirplanesController : JsonApiController<Airplane>
99
{
10-
public AirplanesController(IJsonApiOptions options, ILoggerFactory loggerFactory, IResourceService<Airplane, int> resourceService)
10+
public AirplanesController(IJsonApiOptions options, ILoggerFactory loggerFactory, IResourceService<Airplane> resourceService)
1111
: base(options, loggerFactory, resourceService)
1212
{
1313
}

test/OpenApiTests/OpenApiDocumentTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ public OpenApiDocumentTests()
1818
}
1919

2020
[Fact]
21-
public async Task Retrieved_document_should_match_expected_document()
21+
public async Task Retrieved_document_matches_expected_document()
2222
{
2323
// Arrange
2424
string embeddedResourceName = $"{nameof(OpenApiTests)}.openapi.json";
2525
string expectedDocument = await LoadEmbeddedResourceAsync(embeddedResourceName);
26-
string requestUrl = $"swagger/{nameof(OpenApiTests)}/swagger.json";
26+
string requestUrl = $"swagger/{OpenApiStartup<OpenApiDbContext>.OpenApiDocumentName}/swagger.json";
2727

2828
// Act
2929
string actualDocument = await GetAsync(requestUrl);

test/OpenApiTests/OpenApiStartup.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,26 @@ namespace OpenApiTests
1313
public sealed class OpenApiStartup<TDbContext> : TestableStartup<TDbContext>
1414
where TDbContext : DbContext
1515
{
16+
internal const string OpenApiDocumentName = nameof(OpenApiTests);
17+
1618
public override void ConfigureServices(IServiceCollection services)
1719
{
1820
IMvcCoreBuilder mvcCoreBuilder = services.AddMvcCore();
1921

2022
services.AddJsonApi<TDbContext>(SetJsonApiOptions, mvcBuilder: mvcCoreBuilder);
2123

22-
services.AddOpenApi(mvcCoreBuilder, options => options.SwaggerDoc(nameof(OpenApiTests), new OpenApiInfo
24+
services.AddOpenApi(mvcCoreBuilder, options => options.SwaggerDoc(OpenApiDocumentName, new OpenApiInfo
2325
{
24-
Title = nameof(OpenApiTests),
26+
Title = OpenApiDocumentName,
2527
Version = "1"
2628
}));
2729
}
2830

2931
public override void Configure(IApplicationBuilder app, IWebHostEnvironment environment, ILoggerFactory loggerFactory)
3032
{
3133
app.UseRouting();
32-
3334
app.UseJsonApi();
34-
3535
app.UseSwagger();
36-
3736
app.UseEndpoints(endpoints => endpoints.MapControllers());
3837
}
3938
}

test/OpenApiTests/OpenApiTests.csproj

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<TargetFramework>$(NetCoreAppVersion)</TargetFramework>
4-
</PropertyGroup>
2+
<PropertyGroup>
3+
<TargetFramework>$(NetCoreAppVersion)</TargetFramework>
4+
</PropertyGroup>
55

6-
<ItemGroup>
7-
<None Update="xunit.runner.json">
8-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
9-
</None>
10-
</ItemGroup>
6+
<ItemGroup>
7+
<ProjectReference Include="..\..\src\JsonApiDotNetCore.OpenApi\JsonApiDotNetCore.OpenApi.csproj" />
8+
<ProjectReference Include="..\TestBuildingBlocks\TestBuildingBlocks.csproj" />
9+
</ItemGroup>
1110

12-
<ItemGroup>
13-
<ProjectReference Include="..\..\src\JsonApiDotNetCore.OpenApi\JsonApiDotNetCore.OpenApi.csproj" />
14-
<ProjectReference Include="..\TestBuildingBlocks\TestBuildingBlocks.csproj" />
15-
</ItemGroup>
11+
<ItemGroup>
12+
<PackageReference Include="coverlet.collector" Version="$(CoverletVersion)" PrivateAssets="All" />
13+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(AspNetCoreVersion)" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
15+
</ItemGroup>
1616

17-
<ItemGroup>
18-
<PackageReference Include="coverlet.collector" Version="$(CoverletVersion)" PrivateAssets="All" />
19-
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(AspNetCoreVersion)" />
20-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
21-
</ItemGroup>
17+
<ItemGroup>
18+
<EmbeddedResource Include="openapi.json" />
19+
</ItemGroup>
2220

23-
<ItemGroup>
24-
<EmbeddedResource Include="openapi.json" />
25-
</ItemGroup>
26-
27-
<!-- Fixes IntelliSense errors on openapi.json in Visual Studio 2019, which uses the schema for OpenAPI 3.1 by default. -->
28-
<ProjectExtensions>
29-
<VisualStudio>
30-
<UserProperties openapi_1json__JsonSchema="https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json" />
31-
</VisualStudio>
32-
</ProjectExtensions>
21+
<!-- Fixes IntelliSense errors on openapi.json in Visual Studio 2019, which uses the schema for OpenAPI 3.1 by default. -->
22+
<ProjectExtensions>
23+
<VisualStudio>
24+
<UserProperties integrationtests_4openapi_1json__JsonSchema="https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json" />
25+
</VisualStudio>
26+
</ProjectExtensions>
3327
</Project>

0 commit comments

Comments
 (0)