-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
調整 api response wrapping filter 的內容以配合 blog 說明
- Loading branch information
1 parent
7488633
commit a184382
Showing
6 changed files
with
153 additions
and
21 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
src/dotnetLab.WebApi/Controllers/Requests/DataAnnotationsValidateRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace dotnetLab.WebApi.Controllers.Requests; | ||
|
||
public class DataAnnotationsValidateRequest | ||
{ | ||
[MaxLength(10)] | ||
[MinLength(1)] | ||
public string SerialId { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 16 additions & 1 deletion
17
src/dotnetLab.WebApi/Infrastructure/ResponseWrapper/ApiErrorInformation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
namespace dotnetLab.WebApi.Infrastructure.ResponseWrapper; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace dotnetLab.WebApi.Infrastructure.ResponseWrapper; | ||
|
||
/// <summary> | ||
/// api error information | ||
/// </summary> | ||
public class ApiErrorInformation | ||
{ | ||
/// <summary> | ||
/// 錯誤代號 | ||
/// </summary> | ||
public string ErrorCode { get; set; } | ||
|
||
/// <summary> | ||
/// 錯誤訊息 | ||
/// </summary> | ||
public string Message { get; set; } | ||
|
||
/// <summary> | ||
/// 錯誤詳細說明 | ||
/// </summary> | ||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
public string Description { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters