Skip to content
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
70 changes: 35 additions & 35 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
name: codeql-analysis
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 8 * * MON'
workflow_dispatch:
permissions:
actions: read
contents: read
jobs:
code-ql:
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Initialize CodeQL
name: codeql-analysis

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 8 * * MON'
workflow_dispatch:

permissions:
actions: read
contents: read

jobs:
code-ql:

runs-on: ubuntu-latest

permissions:
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Initialize CodeQL
uses: github/codeql-action/init@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
with:
languages: csharp
build-mode: none
- name: Perform CodeQL Analysis
with:
languages: csharp
build-mode: none

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
with:
category: '/language:csharp'
with:
category: '/language:csharp'
84 changes: 42 additions & 42 deletions .github/workflows/ossf-scorecard.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
name: ossf-scorecard
on:
push:
branches: [ master ]
schedule:
- cron: '0 8 * * MON'
workflow_dispatch:
permissions: read-all
jobs:
analysis:
name: analysis
runs-on: ubuntu-latest
permissions:
id-token: write
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Run analysis
name: ossf-scorecard

on:
push:
branches: [ master ]
schedule:
- cron: '0 8 * * MON'
workflow_dispatch:

permissions: read-all

jobs:
analysis:
name: analysis
runs-on: ubuntu-latest

permissions:
id-token: write
security-events: write

steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false

- name: Run analysis
uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
with:
publish_results: true
results_file: results.sarif
results_format: sarif
- name: Upload artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: SARIF
path: results.sarif
retention-days: 5
- name: Upload to code-scanning
with:
publish_results: true
results_file: results.sarif
results_format: sarif

- name: Upload artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: SARIF
path: results.sarif
retention-days: 5

- name: Upload to code-scanning
uses: github/codeql-action/upload-sarif@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
with:
sarif_file: results.sarif
with:
sarif_file: results.sarif
3 changes: 2 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<Company>https://github.com/domaindrivendev/Swashbuckle.AspNetCore</Company>
<ContinuousIntegrationBuild Condition=" '$(CI)' != '' ">true</ContinuousIntegrationBuild>
<Copyright>Copyright (c) 2016-$([System.DateTime]::Now.ToString(yyyy)) Richard Morris</Copyright>
<DefaultTargetFrameworks>net9.0;net8.0</DefaultTargetFrameworks>
<Deterministic>true</Deterministic>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<EnablePackageValidation>$(IsPackable)</EnablePackageValidation>
Expand Down Expand Up @@ -40,7 +41,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<UseArtifactsOutput>true</UseArtifactsOutput>
<VersionPrefix>8.1.5</VersionPrefix>
<VersionPrefix>9.0.0</VersionPrefix>
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
</PropertyGroup>
<PropertyGroup Condition=" '$(GITHUB_ACTIONS)' != '' AND '$(DEPENDABOT_JOB_ID)' == '' ">
Expand Down
28 changes: 10 additions & 18 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@
<Project>
<ItemGroup>
<PackageVersion Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
<PackageVersion Include="BenchmarkDotNet" Version="0.15.0" />
<PackageVersion Include="BenchmarkDotNet" Version="0.15.1" />
<PackageVersion Include="coverlet.msbuild" Version="6.0.4" />
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageVersion Include="IdentityServer4" Version="3.1.4" />
<PackageVersion Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
<PackageVersion Include="JunitXml.TestLogger" Version="6.1.0" />
<PackageVersion Include="MartinCostello.Logging.XUnit.v3" Version="0.6.0" />
<PackageVersion Include="Microsoft.AspNetCore" Version="2.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.ApiExplorer" Version="2.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.16" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.32" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.17" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.17" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="8.0.16" />
<PackageVersion Include="Microsoft.AspNetCore.Razor.Design" Version="2.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.Routing" Version="2.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.StaticFiles" Version="2.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="6.0.32" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="8.0.17" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="8.0.17" />
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="4.14.0" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Embedded" Version="2.1.1" />
<PackageVersion Include="Microsoft.OpenApi" Version="1.6.23" />
<PackageVersion Include="Microsoft.OpenApi.Readers" Version="1.6.23" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="NSwag.MSBuild" Version="14.4.0" />
<PackageVersion Include="ReportGenerator" Version="5.4.7" />
<PackageVersion Include="System.Text.Json" Version="4.6.0" />
<PackageVersion Include="Verify.XunitV3" Version="30.3.0" />
<PackageVersion Include="Verify.XunitV3" Version="30.4.0" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.0" />
<PackageVersion Include="xunit.v3" Version="2.0.2" />
<PackageVersion Include="xunit.v3.extensibility.core" Version="2.0.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.1" />
<PackageVersion Include="xunit.v3" Version="2.0.3" />
<PackageVersion Include="xunit.v3.extensibility.core" Version="2.0.3" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ public void Apply(OpenApiOperation operation, OperationFilterContext context)
actionAttributes = methodInfo.GetCustomAttributes(true);
}

#if NET
if (context.ApiDescription?.ActionDescriptor?.EndpointMetadata is { } metadata)
{
metadataAttributes = metadata;
}
#endif

// NOTE: When controller and action attributes are applicable, action attributes should take priority.
// Hence, why they're at the end of the list (i.e. last one wins).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,6 @@ private static IEnumerable<Type> AnnotationsSubTypesSelector(Type type)
return subTypeAttributes.Select(attr => attr.SubType);
}

#pragma warning disable CS0618 // Type or member is obsolete
var obsoleteAttribute = type.GetCustomAttributes(false)
.OfType<SwaggerSubTypesAttribute>()
.FirstOrDefault();
#pragma warning restore CS0618 // Type or member is obsolete

if (obsoleteAttribute != null)
{
return obsoleteAttribute.SubTypes;
}

#if NET
var jsonDerivedTypeAttributes = type.GetCustomAttributes(false)
.OfType<JsonDerivedTypeAttribute>()
.ToList();
Expand All @@ -82,7 +70,6 @@ private static IEnumerable<Type> AnnotationsSubTypesSelector(Type type)
{
return jsonDerivedTypeAttributes.Select(attr => attr.DerivedType);
}
#endif

return [];
}
Expand All @@ -98,18 +85,6 @@ private static string AnnotationsDiscriminatorNameSelector(Type baseType)
return discriminatorAttribute.PropertyName;
}

#pragma warning disable CS0618 // Type or member is obsolete
var obsoleteAttribute = baseType.GetCustomAttributes(false)
.OfType<SwaggerSubTypesAttribute>()
.FirstOrDefault();
#pragma warning restore CS0618 // Type or member is obsolete

if (obsoleteAttribute != null)
{
return obsoleteAttribute.Discriminator;
}

#if NET
var jsonPolymorphicAttributes = baseType.GetCustomAttributes(false)
.OfType<JsonPolymorphicAttribute>()
.FirstOrDefault();
Expand All @@ -118,7 +93,6 @@ private static string AnnotationsDiscriminatorNameSelector(Type baseType)
{
return jsonPolymorphicAttributes.TypeDiscriminatorPropertyName;
}
#endif

return null;
}
Expand All @@ -137,7 +111,6 @@ private static string AnnotationsDiscriminatorValueSelector(Type subType)
return subTypeAttribute.DiscriminatorValue;
}

#if NET
var jsonDerivedTypeAttributes = baseType.GetCustomAttributes(false)
.OfType<JsonDerivedTypeAttribute>()
.FirstOrDefault(attr => attr.DerivedType == subType);
Expand All @@ -146,7 +119,6 @@ private static string AnnotationsDiscriminatorValueSelector(Type subType)
{
return discriminator;
}
#endif

baseType = baseType.BaseType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ Swashbuckle.AspNetCore.Annotations.SwaggerSubTypeAttribute.DiscriminatorValue.se
Swashbuckle.AspNetCore.Annotations.SwaggerSubTypeAttribute.SubType.get -> System.Type
Swashbuckle.AspNetCore.Annotations.SwaggerSubTypeAttribute.SubType.set -> void
Swashbuckle.AspNetCore.Annotations.SwaggerSubTypeAttribute.SwaggerSubTypeAttribute(System.Type subType) -> void
Swashbuckle.AspNetCore.Annotations.SwaggerSubTypesAttribute
Swashbuckle.AspNetCore.Annotations.SwaggerSubTypesAttribute.Discriminator.get -> string
Swashbuckle.AspNetCore.Annotations.SwaggerSubTypesAttribute.Discriminator.set -> void
Swashbuckle.AspNetCore.Annotations.SwaggerSubTypesAttribute.SubTypes.get -> System.Collections.Generic.IEnumerable<System.Type>
Swashbuckle.AspNetCore.Annotations.SwaggerSubTypesAttribute.SwaggerSubTypesAttribute(params System.Type[] subTypes) -> void
Swashbuckle.AspNetCore.Annotations.SwaggerTagAttribute
Swashbuckle.AspNetCore.Annotations.SwaggerTagAttribute.Description.get -> string
Swashbuckle.AspNetCore.Annotations.SwaggerTagAttribute.ExternalDocsUrl.get -> string
Expand Down

This file was deleted.

10 changes: 0 additions & 10 deletions src/Swashbuckle.AspNetCore.Annotations/SwaggerSubTypesAttribute.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<NoWarn>$(NoWarn);1591</NoWarn>
<PackageTags>swagger;documentation;discovery;help;webapi;aspnet;aspnetcore;annotations</PackageTags>
<SignAssembly>true</SignAssembly>
<TargetFrameworks>net9.0;net8.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>$(DefaultTargetFrameworks)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<IsTestProject>false</IsTestProject>
<NoWarn>$(NoWarn);1591</NoWarn>
<PackageTags>swagger;openapi;test-first;spec-first;testing;aspnetcore;xunit</PackageTags>
<TargetFrameworks>net9.0;net8.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>$(DefaultTargetFrameworks)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 0 additions & 4 deletions src/Swashbuckle.AspNetCore.ApiTesting/ApiTestRunnerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ public async Task TestAsync(
throw new InvalidOperationException($"Operation with id '{operationId}' not found in OpenAPI document '{documentName}'");
}

#if NET
if (expectedStatusCode.StartsWith('2'))
#else
if (expectedStatusCode.StartsWith("2"))
#endif
{
_requestValidator.Validate(request, openApiDocument, pathTemplate, operationType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<IsPackable>true</IsPackable>
<NoWarn>$(NoWarn);1591</NoWarn>
<PackageTags>swagger;openapi;test-first;spec-first;testing;aspnetcore</PackageTags>
<TargetFrameworks>net9.0;net8.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>$(DefaultTargetFrameworks)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -15,10 +15,6 @@
<PackageReference Include="Newtonsoft.Json" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" VersionOverride="2.3.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" VersionOverride="8.0.0" />
</ItemGroup>
Expand Down
Loading