Skip to content
This repository has been archived by the owner on Nov 13, 2021. It is now read-only.

Commit

Permalink
#111 statuscode 400 in swagger and update guideline
Browse files Browse the repository at this point in the history
  • Loading branch information
pietersap committed Mar 22, 2019
1 parent 5f13698 commit bfc7c98
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions maturity-level-one/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ This allows you to be secure on the physical API while the consumers can still u
- Less details compared to a custom data contract
- Read [this blog post](https://tech.domain.com.au/2017/11/please-dont-spare-me-the-details/) on how to achieve this
- If the above suggestion is not possible you should use a custom data contract. See Microsoft example [here](https://github.com/Microsoft/api-guidelines/blob/master/Guidelines.md#7102-error-condition-responses).
- For all controllers, document all possible return status codes using a [SwaggerResponse] attribute.
- Shouldn't there be a general response for our API's, a general scheme we can use after all? Maybe using trackingcodes etc with map to app insights?

## Document your APIs
Expand Down
1 change: 1 addition & 0 deletions maturity-level-one/src/Controllers/v1/PlayersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace Codit.LevelOne.Controllers.v1
[Route("world-cup/v1/[controller]")]
[ApiController]
[ValidateModel]
[SwaggerResponse((int) HttpStatusCode.BadRequest, "Input validation error.")]
public class PlayersController : ControllerBase
{
private const string GetPlayerRoute = "Players_GetPlayer";
Expand Down
1 change: 1 addition & 0 deletions maturity-level-one/src/Controllers/v1/TeamsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace Codit.LevelOne.Controllers.v1
[Route("world-cup/v1/[controller]")]
[ApiController]
[ValidateModel]
[SwaggerResponse((int)HttpStatusCode.BadRequest, "Input validation error.")]
public class TeamsController : ControllerBase
{
private readonly IWorldCupRepository _worldCupRepository;
Expand Down
1 change: 1 addition & 0 deletions maturity-level-two/src/Controllers/v1/CarController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace Codit.LevelTwo.Controllers.v1
[Route("codito/v1/[controller]")]
[ApiController]
[ValidateModel]
[SwaggerResponse((int)HttpStatusCode.BadRequest, "Input validation error.")]
public class CarController : ControllerBase
{
private readonly ICoditoRepository _coditoRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace Codit.LevelTwo.Controllers.v1
[Route("codito/v1/[controller]")]
[ApiController]
[ValidateModel]
[SwaggerResponse((int)HttpStatusCode.BadRequest, "Input validation error.")]
public class CustomizationController : ControllerBase
{

Expand Down

0 comments on commit bfc7c98

Please sign in to comment.