Skip to content

Commit f97c53d

Browse files
committed
conflict merge
2 parents 23cee53 + cfb54fe commit f97c53d

File tree

7 files changed

+39
-15
lines changed

7 files changed

+39
-15
lines changed

.github/workflows/sonarqube-analysis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v2
1313
with:
14-
# Disabling shallow clone is recommended for improving relevancy of reporting
1514
fetch-depth: 0
1615
- name: SonarScanner for .NET Core with pull request decoration support
1716
uses: highbyte/sonarscan-dotnet@1.0
@@ -20,9 +19,8 @@ jobs:
2019
sonarProjectName: qatoolkit_qatoolkit-source-swagger-net
2120
sonarOrganization: qatoolkit
2221
dotnetBuildArguments: ./src/QAToolKit.Source.Swagger/QAToolKit.Source.Swagger.csproj
23-
dotnetDisableTests: true
24-
# Optional extra command arguments the the SonarScanner 'begin' command
25-
sonarBeginArguments: /d:sonar.verbose="true" /d:sonar.language="cs"
22+
dotnetTestArguments: ./src/QAToolKit.Source.Swagger.Test/QAToolKit.Source.Swagger.Test.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
23+
sonarBeginArguments: /d:sonar.verbose="true" /d:sonar.language="cs" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml" /d:sonar.coverage.exclusions="**Tests.cs"
2624
sonarHostname: "https://sonarcloud.io"
2725
env:
2826
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# QAToolKit.Source.Swagger
22
![.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)
36

7+
## Description
48
`QAToolKit.Source.Swagger` is a .NET standard library, which generates `IEnumerable<HttpRequest>` object that is the input for other components.
59

610
Major features:
@@ -120,8 +124,9 @@ check Swagger for example files and populate those.
120124

121125
By default this option is set to false.
122126

123-
## Limitations
127+
## To-do
124128

129+
- **This library is an early alpha version**
125130
- Swagger processor only returns `application/json` content type. Support for other might come later.
126131
- Data generation and replacement is only supported for Path, Url and Json Body properties.
127132

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10+
<PackageReference Include="coverlet.msbuild" Version="2.9.0">
11+
<PrivateAssets>all</PrivateAssets>
12+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
13+
</PackageReference>
1014
<PackageReference Include="ExpectedObjects" Version="2.3.5" />
1115
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.9" />
1216
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.9" />

src/QAToolKit.Source.Swagger/Exceptions/QAToolKitSwaggerException.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,29 @@
33

44
namespace QAToolKit.Source.Swagger.Exceptions
55
{
6-
internal class QAToolKitSwaggerException : Exception
6+
/// <summary>
7+
/// QA Toolkit swagger exception
8+
/// </summary>
9+
[Serializable]
10+
public class QAToolKitSwaggerException : Exception
711
{
12+
/// <summary>
13+
/// QA Toolkit swagger exception
14+
/// </summary>
815
public QAToolKitSwaggerException(string message) : base(message)
916
{
1017
}
1118

19+
/// <summary>
20+
/// QA Toolkit swagger exception
21+
/// </summary>
1222
public QAToolKitSwaggerException(string message, Exception innerException) : base(message, innerException)
1323
{
1424
}
1525

26+
/// <summary>
27+
/// QA Toolkit swagger exception
28+
/// </summary>
1629
protected QAToolKitSwaggerException(SerializationInfo info, StreamingContext context) : base(info, context)
1730
{
1831
}

src/QAToolKit.Source.Swagger/SwaggerProcessor.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private IEnumerable<HttpRequest> GetRestRequestsForPath(Uri baseUri, KeyValuePai
8585
Summary = GetSummary(operation),
8686
Description = GetDescription(operation),
8787
OperationId = GetOperationId(operation),
88-
Parameters = GetParameters(operation).ToList().ToList(),
88+
Parameters = GetParameters(operation).ToList(),
8989
RequestBodies = GetRequestBodies(operation),
9090
Responses = GetResponses(operation),
9191
Tags = GetTags(operation),
@@ -425,11 +425,10 @@ private List<Property> GetPropertiesRecursively(KeyValuePair<string, OpenApiSche
425425
{
426426
var propsTem = GetPropertiesRecursively(property);
427427

428-
if (propsTem != null)
429-
if (prop.Properties == null)
430-
{
431-
prop.Properties = new List<Property>();
432-
}
428+
if (propsTem != null && prop.Properties == null)
429+
{
430+
prop.Properties = new List<Property>();
431+
}
433432
prop.Properties.AddRange(propsTem);
434433
}
435434

src/QAToolKit.Source.Swagger/SwaggerRequestFilter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ public IEnumerable<HttpRequest> FilterRequests(RequestFilter requestFilter)
3131

3232
if (requestFilter.AuthenticationTypes != null)
3333
{
34-
requestsLocal.AddRange(_requests.Where(request => requestFilter.AuthenticationTypes.ToList().Any(x => request.AuthenticationTypes.Contains(x))));
34+
requestsLocal.AddRange(_requests.Where(request => requestFilter.AuthenticationTypes.Any(x => request.AuthenticationTypes.Contains(x))));
3535
}
3636

3737
if (requestFilter.TestTypes != null)
3838
{
39-
requestsLocal.AddRange(_requests.Where(request => requestFilter.TestTypes.ToList().Any(x => request.TestTypes.Contains(x))));
39+
requestsLocal.AddRange(_requests.Where(request => requestFilter.TestTypes.Any(x => request.TestTypes.Contains(x))));
4040
}
4141

4242
if (requestFilter.EndpointNameWhitelist != null)

src/QAToolKit.Source.Swagger/SwaggerUrlSource.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ public SwaggerUrlSource(Action<SwaggerOptions> options = null)
3434
/// </summary>
3535
/// <param name="source"></param>
3636
/// <returns></returns>
37-
public async Task<IEnumerable<HttpRequest>> Load(Uri[] source)
37+
public Task<IEnumerable<HttpRequest>> Load(Uri[] source)
3838
{
3939
if (source == null) throw new ArgumentNullException(nameof(source));
4040

41+
return LoadInternal(source);
42+
}
43+
44+
private async Task<IEnumerable<HttpRequest>> LoadInternal(Uri[] source)
45+
{
4146
var restRequests = new List<HttpRequest>();
4247
var processor = new SwaggerProcessor(_swaggerOptions);
4348

0 commit comments

Comments
 (0)