Skip to content

Commit 6c2c96f

Browse files
authoredNov 14, 2020
.Net 5 support and release
1 parent f97c53d commit 6c2c96f

14 files changed

+159
-19
lines changed
 

‎.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: mihaj
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Additional context**
32+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement
6+
assignees: mihaj
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

‎.github/workflows/codeql-analysis.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ jobs:
3333
steps:
3434
- name: Checkout repository
3535
uses: actions/checkout@v2
36-
36+
- name: Setup .NET Core 3.1
37+
uses: actions/setup-dotnet@v1
38+
with:
39+
dotnet-version: '3.1.x'
40+
- name: Setup .NET Core 5.0
41+
uses: actions/setup-dotnet@v1
42+
with:
43+
dotnet-version: '5.0.x'
3744
# Initializes the CodeQL tools for scanning.
3845
- name: Initialize CodeQL
3946
uses: github/codeql-action/init@v1

‎.github/workflows/dotnet-core.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ jobs:
1818

1919
steps:
2020
- uses: actions/checkout@v2
21-
- name: Setup .NET Core
21+
- name: Setup .NET Core 3.1
2222
uses: actions/setup-dotnet@v1
2323
with:
24-
dotnet-version: 3.1.403
24+
dotnet-version: '3.1.x'
25+
- name: Setup .NET Core 5.0
26+
uses: actions/setup-dotnet@v1
27+
with:
28+
dotnet-version: '5.0.x'
2529
- name: Install dependencies
2630
run: dotnet restore
2731
- name: Build
@@ -42,6 +46,14 @@ jobs:
4246
runs-on: ubuntu-latest
4347
steps:
4448
- uses: actions/checkout@v2
49+
- name: Setup .NET Core 3.1
50+
uses: actions/setup-dotnet@v1
51+
with:
52+
dotnet-version: '3.1.x'
53+
- name: Setup .NET Core 5.0
54+
uses: actions/setup-dotnet@v1
55+
with:
56+
dotnet-version: '5.0.x'
4557
- name: Pack NuGet
4658
uses: brandedoutcast/publish-nuget@v2.5.5
4759
with:

‎.github/workflows/sonarqube-analysis.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,16 @@ jobs:
1212
- uses: actions/checkout@v2
1313
with:
1414
fetch-depth: 0
15+
- name: Setup .NET Core 3.1
16+
uses: actions/setup-dotnet@v1
17+
with:
18+
dotnet-version: '3.1.x'
19+
- name: Setup .NET Core 5.0
20+
uses: actions/setup-dotnet@v1
21+
with:
22+
dotnet-version: '5.0.x'
1523
- name: SonarScanner for .NET Core with pull request decoration support
16-
uses: highbyte/sonarscan-dotnet@1.0
24+
uses: highbyte/sonarscan-dotnet@2.0-beta
1725
with:
1826
sonarProjectKey: qatoolkit_qatoolkit-source-swagger-net
1927
sonarProjectName: qatoolkit_qatoolkit-source-swagger-net

‎.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,4 +359,5 @@ MigrationBackup/
359359
.ionide/
360360

361361
# Fody - auto-generated XML schema
362-
FodyWeavers.xsd
362+
FodyWeavers.xsd
363+
/src/QAToolKit.Source.Swagger.Test/global.json

‎Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>0.2.0</Version>
3+
<Version>0.3.0</Version>
44
</PropertyGroup>
55
</Project>

‎README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# QAToolKit.Source.Swagger
2-
![.NET Core](https://github.com/qatoolkit/qatoolkit-source-swagger-net/workflows/.NET%20Core/badge.svg)
3-
![CodeQL Analyze](https://github.com/qatoolkit/qatoolkit-source-swagger-net/workflows/CodeQL%20Analyze/badge.svg)
4-
![Sonarqube Analyze](https://github.com/qatoolkit/qatoolkit-source-swagger-net/workflows/Sonarqube%20Analyze/badge.svg)
5-
![](https://img.shields.io/nuget/v/QAToolKit.Source.Swagger?label=QAToolKit.Source.Swagger)
2+
![https://github.com/qatoolkit/qatoolkit-source-swagger-net/actions](https://github.com/qatoolkit/qatoolkit-source-swagger-net/workflows/.NET%20Core/badge.svg)
3+
![https://github.com/qatoolkit/qatoolkit-source-swagger-net/security/code-scanning](https://github.com/qatoolkit/qatoolkit-source-swagger-net/workflows/CodeQL%20Analyze/badge.svg)
4+
![https://sonarcloud.io/dashboard?id=qatoolkit_qatoolkit-source-swagger-net](https://github.com/qatoolkit/qatoolkit-source-swagger-net/workflows/Sonarqube%20Analyze/badge.svg)
5+
![https://www.nuget.org/packages/QAToolKit.Source.Swagger/](https://img.shields.io/nuget/v/QAToolKit.Source.Swagger?label=QAToolKit.Source.Swagger)
66

77
## Description
8-
`QAToolKit.Source.Swagger` is a .NET standard library, which generates `IEnumerable<HttpRequest>` object that is the input for other components.
8+
`QAToolKit.Source.Swagger` is a .NET library, which generates `IEnumerable<HttpRequest>` object that is the input for other components.
9+
10+
Supported .NET frameworks and standards: `netstandard2.0`, `netstandard2.1`, `netcoreapp3.1`, `net5.0`
911

1012
Major features:
1113

‎qatoolkit-64x64.png

2.11 KB
Loading
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using QAToolKit.Source.Swagger.Exceptions;
2+
using System;
3+
using Xunit;
4+
5+
namespace QAToolKit.Source.Swagger.Test.Exceptions
6+
{
7+
public class QAToolKitSwaggerExceptionTests
8+
{
9+
[Fact]
10+
public void CreateExceptionTest_Successful()
11+
{
12+
var exception = new QAToolKitSwaggerException("my error");
13+
14+
Assert.Equal("my error", exception.Message);
15+
}
16+
17+
[Fact]
18+
public void CreateExceptionWithInnerExceptionTest_Successful()
19+
{
20+
var innerException = new Exception("Inner");
21+
var exception = new QAToolKitSwaggerException("my error", innerException);
22+
23+
Assert.Equal("my error", exception.Message);
24+
Assert.Equal("Inner", innerException.Message);
25+
}
26+
}
27+
}

‎src/QAToolKit.Source.Swagger.Test/QAToolKit.Source.Swagger.Test.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
@@ -11,10 +11,10 @@
1111
<PrivateAssets>all</PrivateAssets>
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
</PackageReference>
14-
<PackageReference Include="ExpectedObjects" Version="2.3.5" />
15-
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.9" />
16-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.9" />
17-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
14+
<PackageReference Include="ExpectedObjects" Version="2.3.6" />
15+
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
16+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
17+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
1818
<PackageReference Include="xunit" Version="2.4.1" />
1919
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
2020
<PrivateAssets>all</PrivateAssets>

‎src/QAToolKit.Source.Swagger.Test/SwaggerUrlSourceIntegrationTests.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public async Task SwaggerUrlSourceWithOptionsV3Test_Successfull()
5454
}
5555

5656
[Fact]
57-
public async Task SwaggerUrlSourceWithoutUrlV3Test_Fails()
57+
public async Task SwaggerUrlSourceUriFormatExceptionTest_Fails()
5858
{
5959
var urlSource = new SwaggerUrlSource();
6060
await Assert.ThrowsAsync<UriFormatException>(async () => await urlSource.Load(
@@ -63,5 +63,28 @@ await Assert.ThrowsAsync<UriFormatException>(async () => await urlSource.Load(
6363
new Uri("")
6464
}));
6565
}
66+
67+
68+
[Fact]
69+
public async Task WrongSwaggerUrlSourceArgumentNullExceptionTest_Fails()
70+
{
71+
var urlSource = new SwaggerUrlSource();
72+
await Assert.ThrowsAsync<ArgumentNullException>(async () => await urlSource.Load(
73+
new Uri[]
74+
{
75+
new Uri("https://qatoolkitapi.azurewebsites.net/swagger/index.html")
76+
}));
77+
}
78+
79+
[Fact]
80+
public async Task WrongSwaggerUrlSourceArgumentNullException2Test_Fails()
81+
{
82+
var urlSource = new SwaggerUrlSource();
83+
await Assert.ThrowsAsync<ArgumentNullException>(async () => await urlSource.Load(
84+
new Uri[]
85+
{
86+
new Uri("https://github.com")
87+
}));
88+
}
6689
}
6790
}

‎src/QAToolKit.Source.Swagger/QAToolKit.Source.Swagger.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0</TargetFrameworks>
55
<GenerateDocumentationFile>true</GenerateDocumentationFile>
66
<LangVersion>latest</LangVersion>
77
<ProjectGuid>ee940718-945a-4c34-8ce6-0790972ada44</ProjectGuid>
@@ -37,7 +37,7 @@
3737
<PackageReference Include="Microsoft.OpenApi" Version="1.2.3" />
3838
<PackageReference Include="Microsoft.OpenApi.Readers" Version="1.2.3" />
3939
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
40-
<PackageReference Include="QAToolKit.Core" Version="0.2.2" />
40+
<PackageReference Include="QAToolKit.Core" Version="0.3.0" />
4141
</ItemGroup>
4242

4343
</Project>

‎src/QAToolKit.Source.Swagger/SwaggerProcessor.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ public SwaggerProcessor(SwaggerOptions swaggerOptions)
3636
/// <returns></returns>
3737
public IEnumerable<HttpRequest> MapFromOpenApiDocument(Uri baseUri, OpenApiDocument openApiDocument)
3838
{
39+
if (openApiDocument == null || openApiDocument.Paths == null)
40+
{
41+
throw new ArgumentNullException(nameof(openApiDocument));
42+
}
43+
3944
var restRequests = new List<HttpRequest>();
4045

4146
var server = openApiDocument.Servers.FirstOrDefault();
@@ -194,6 +199,9 @@ private HttpMethod GetHttpMethod(KeyValuePair<OperationType, OpenApiOperation> o
194199
#elif NETCOREAPP3_1
195200
case "patch":
196201
return HttpMethod.Patch;
202+
#elif NET5_0
203+
case "patch":
204+
return HttpMethod.Patch;
197205
#endif
198206
default:
199207
throw new QAToolKitSwaggerException($"HttpMethod invalid '{httpMethodString}'.");

0 commit comments

Comments
 (0)