Skip to content
This repository was archived by the owner on Aug 30, 2025. It is now read-only.

Commit 8cc174d

Browse files
authored
Merge pull request #11 from TechNobre/develop
Add `Response413ProblemDetailsAttribute`
2 parents 305b398 + a69fec9 commit 8cc174d

15 files changed

+138
-62
lines changed
Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,47 @@
1-
name: 'Publish Nuget'
1+
name: 'Publish nuget'
2+
3+
24

35
on:
46
push:
57
branches:
6-
- main
8+
- deploy-nuget
9+
10+
11+
12+
env:
13+
SDK_VERSION: '6.0.300'
14+
PACKAGE_PATH: ./src/**/*.nupkg
15+
NUGET_SERVER: https://api.nuget.org/v3/index.json
16+
717

818

919
jobs:
1020

1121
deploy-nuget:
12-
name: "Deploy NuGet"
22+
name: "Deploy nuget"
1323
runs-on: ubuntu-latest
1424

1525
steps:
16-
- uses: actions/checkout@main
26+
- name: "Checkout"
27+
uses: actions/checkout@v3
1728

18-
- name: Setup .NET
29+
- name: "Setup .NET"
1930
uses: actions/setup-dotnet@v2
2031
with:
21-
dotnet-version: '6.0.201'
32+
dotnet-version: ${{ env.SDK_VERSION }}
2233

23-
- name: Restore dependencies
34+
- name: "Restore dependencies"
2435
run: dotnet restore
2536

26-
- name: Build
27-
run: dotnet build --configuration Release
37+
- name: "Build"
38+
run: dotnet build --configuration Release --no-restore
39+
40+
- name: "Test"
41+
run: dotnet test --configuration Release --no-build
2842

29-
- name: Create the Package
30-
run: dotnet pack --configuration Release
43+
- name: "Pack"
44+
run: dotnet pack --configuration Release --no-build
3145

32-
- name: Publish
33-
run: dotnet nuget push "./src/bin/PowerUtils.AspNetCore.ErrorHandler.ResponseTypes.*.nupkg" -k ${{ secrets.NUGET_TOKEN }} -s https://api.nuget.org/v3/index.json
46+
- name: "Publish nuget"
47+
run: dotnet nuget push ${{ env.PACKAGE_PATH }} --api-key ${{ secrets.NUGET_TOKEN }} --source ${{ env.NUGET_SERVER }} --skip-duplicate

.github/workflows/sonarcloud.yml

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: 'SonarCloud'
22

3+
4+
35
on:
46
push:
57
branches:
@@ -10,57 +12,64 @@ on:
1012
- main
1113

1214

15+
16+
env:
17+
SDK_VERSION: '6.0.300'
18+
19+
20+
1321
jobs:
1422

1523
sonar-scanner:
1624
name: "Sonar scanner"
1725
runs-on: windows-latest
18-
steps:
1926

20-
- name: Setup .NET
27+
steps:
28+
- name: "Setup .NET"
2129
uses: actions/setup-dotnet@v2
2230
with:
23-
dotnet-version: '6.0.201'
31+
dotnet-version: ${{ env.SDK_VERSION }}
2432

25-
- name: Set up JDK 11
26-
uses: actions/setup-java@v3.0.0
33+
- name: "Set up JDK 11"
34+
uses: actions/setup-java@v3.3.0
2735
with:
2836
distribution: 'adopt'
2937
java-version: '11'
3038

31-
- uses: actions/checkout@v2
39+
- name: "Checkout"
40+
uses: actions/checkout@v3
3241
with:
3342
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
3443

35-
- name: Cache SonarCloud packages
36-
uses: actions/cache@v2.1.7
44+
- name: "Cache SonarCloud packages"
45+
uses: actions/cache@v3
3746
with:
3847
path: ~\sonar\cache
3948
key: ${{ runner.os }}-sonar
4049
restore-keys: ${{ runner.os }}-sonar
4150

42-
- name: Cache SonarCloud scanner
51+
- name: "Cache SonarCloud scanner"
4352
id: cache-sonar-scanner
44-
uses: actions/cache@v2.1.7
53+
uses: actions/cache@v3
4554
with:
4655
path: .\.sonar\scanner
4756
key: ${{ runner.os }}-sonar-scanner
4857
restore-keys: ${{ runner.os }}-sonar-scanner
4958

50-
- name: Install SonarCloud scanner
59+
- name: "Install SonarCloud scanner"
5160
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
5261
shell: pwsh
5362
run: |
5463
New-Item -Path .\.sonar\scanner -ItemType Directory
5564
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
5665
57-
- name: Build and analyze
66+
- name: "Build and analyze"
5867
env:
5968
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
6069
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
6170
shell: pwsh
6271
run: |
6372
.\.sonar\scanner\dotnet-sonarscanner begin /k:"${{ secrets.SONAR_PROJECT_KEY }}" /o:"${{ secrets.SONAR_ORGANIZATION }}" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
64-
dotnet build --configuration Release
65-
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
66-
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
73+
dotnet build
74+
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --no-build
75+
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

.github/workflows/test-project.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,40 @@
11
name: 'Tests'
22

3+
4+
35
on:
4-
push:
5-
branches:
6-
- develop
76
pull_request:
87
types: [opened, reopened, synchronize]
98
branches:
109
- main
1110

1211

12+
13+
env:
14+
SDK_VERSION: '6.0.300'
15+
16+
17+
1318
jobs:
1419

1520
test-project:
16-
name: "Testing project"
21+
name: "Test nuget"
1722
runs-on: ubuntu-latest
1823

1924
steps:
20-
- uses: actions/checkout@v2
25+
- name: "Checkout"
26+
uses: actions/checkout@v3
2127

22-
- name: Setup .NET
28+
- name: "Setup .NET"
2329
uses: actions/setup-dotnet@v2
2430
with:
25-
dotnet-version: '6.0.201'
31+
dotnet-version: ${{ env.SDK_VERSION }}
2632

27-
- name: Restore dependencies
33+
- name: "Restore dependencies"
2834
run: dotnet restore
2935

30-
- name: Build
31-
run: dotnet build --no-restore
36+
- name: "Build"
37+
run: dotnet build --configuration Release --no-restore
3238

33-
- name: Test
34-
run: dotnet test --no-build
39+
- name: "Test"
40+
run: dotnet test --configuration Release --no-build

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33

44

55

6+
## [1.1.0] - 2022-05-29
7+
[Full Changelog](https://github.com/TechNobre/PowerUtils.AspNetCore.ErrorHandler.ResponseTypes/compare/v1.0.0...v1.1.0)
8+
9+
10+
### New Features
11+
12+
- Added `Response413ProblemDetailsAttribute`;
13+
14+
15+
16+
617
## [1.0.0] - 2022-03-15
718

819
- Kickoff;

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "6.0.201"
3+
"version": "6.0.300"
44
}
55
}

src/PowerUtils.AspNetCore.ErrorHandler.ResponseTypes.csproj

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<PropertyGroup>
44
<ProjectGuid>1d1e25dd-40ce-42e8-80b8-ea44fad54efc</ProjectGuid>
55

6+
<CurrentYear>$([System.DateTime]::UtcNow.ToString(yyyy))</CurrentYear>
7+
68

79
<!-- Assembly and projecto details -->
810
<!-- https://docs.microsoft.com/en-us/dotnet/standard/frameworks -->
@@ -14,19 +16,17 @@
1416
<PackageId>PowerUtils.AspNetCore.ErrorHandler.ResponseTypes</PackageId>
1517
<title>PowerUtils.AspNetCore.ErrorHandler.ResponseTypes</title>
1618
<Product>PowerUtils.AspNetCore.ErrorHandler.ResponseTypes</Product>
17-
<Version>1.0.0</Version>
19+
<Version>1.1.0</Version>
1820

1921
<Authors>Nelson Nobre</Authors>
2022
<Company>TechNobre</Company>
2123

2224
<License>MIT</License>
2325
<PackageLicenseFile>LICENSE</PackageLicenseFile>
24-
<Copyright>Copyright © 2022 by TechNobre</Copyright>
26+
<Copyright>Copyright © $(CurrentYear) by TechNobre</Copyright>
2527

2628
<Description>Extensions to standardize ResponseType attributes with ProblemDetails</Description>
27-
<PackageReleaseNotes>
28-
Kickoff
29-
</PackageReleaseNotes>
29+
<PackageReleaseNotes>https://github.com/TechNobre/PowerUtils.AspNetCore.ErrorHandler.ResponseTypes/blob/main/CHANGELOG.md</PackageReleaseNotes>
3030
<Summary>Extensions to standardize ResponseType attributes with ProblemDetails</Summary>
3131
<PackageTags>PowerUtils;Utils;Helpers;Attributes;ResponseTypes;Extension;Extensions;AspNetCore;ProblemDetails</PackageTags>
3232
<RepositoryUrl>https://github.com/TechNobre/PowerUtils.AspNetCore.ErrorHandler.ResponseTypes</RepositoryUrl>
@@ -58,31 +58,20 @@
5858
<PlatformTarget>AnyCPU</PlatformTarget>
5959
<DebugType>none</DebugType>
6060
<Optimize>true</Optimize>
61-
<DefineConstants>RELEASE;TRACE</DefineConstants>
61+
<DefineConstants>TRACE</DefineConstants>
6262
<ErrorReport>none</ErrorReport>
6363
<WarningLevel>4</WarningLevel>
6464
</PropertyGroup>
6565

6666

67-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
68-
<DefineConstants>NETCOREAPP;NETCOREAPP3_1</DefineConstants>
69-
</PropertyGroup>
70-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
71-
<DefineConstants>NET;NET5</DefineConstants>
72-
</PropertyGroup>
73-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
74-
<DefineConstants>NET;NET6</DefineConstants>
75-
</PropertyGroup>
76-
77-
7867
<ItemGroup>
7968
<None Include="..\LICENSE" Pack="true" PackagePath="" />
8069
</ItemGroup>
8170

8271

8372
<ItemGroup>
8473
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
85-
<PackageReference Include="PowerUtils.AspNetCore.ErrorHandler" Version="1.0.0" />
74+
<PackageReference Include="PowerUtils.AspNetCore.ErrorHandler" Version="1.1.0" />
8675
</ItemGroup>
8776

8877

src/Response400ProblemDetailsAttribute.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace PowerUtils.AspNetCore.Attributes
66
{
7+
/// <summary>
8+
/// Problem details response with status code 400 (BadRequest)
9+
/// </summary>
710
public class Response400ProblemDetailsAttribute : ProducesResponseTypeAttribute
811
{
912
public Response400ProblemDetailsAttribute() : base(typeof(ProblemDetailsResponse), StatusCodes.Status400BadRequest) { }

src/Response401ProblemDetailsAttribute.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace PowerUtils.AspNetCore.Attributes
66
{
7+
/// <summary>
8+
/// Problem details response with status code 401 (Unauthorized)
9+
/// </summary>
710
public class Response401ProblemDetailsAttribute : ProducesResponseTypeAttribute
811
{
912
public Response401ProblemDetailsAttribute() : base(typeof(ProblemDetailsResponse), StatusCodes.Status401Unauthorized) { }

src/Response403ProblemDetailsAttribute.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace PowerUtils.AspNetCore.Attributes
66
{
7+
/// <summary>
8+
/// Problem details response with status code 403 (Forbidden)
9+
/// </summary>
710
public class Response403ProblemDetailsAttribute : ProducesResponseTypeAttribute
811
{
912
public Response403ProblemDetailsAttribute() : base(typeof(ProblemDetailsResponse), StatusCodes.Status403Forbidden) { }

src/Response404ProblemDetailsAttribute.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace PowerUtils.AspNetCore.Attributes
66
{
7+
/// <summary>
8+
/// Problem details response with status code 404 (NotFound)
9+
/// </summary>
710
public class Response404ProblemDetailsAttribute : ProducesResponseTypeAttribute
811
{
912
public Response404ProblemDetailsAttribute() : base(typeof(ProblemDetailsResponse), StatusCodes.Status404NotFound) { }

0 commit comments

Comments
 (0)