From 6c828a29ec1066693dd94517ab59531f25d46bde Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Fri, 12 Jun 2020 14:10:43 +0200 Subject: [PATCH] Update greenfield-development.md --- docs/greenfield-development.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/greenfield-development.md b/docs/greenfield-development.md index 444c4831d..dde987916 100644 --- a/docs/greenfield-development.md +++ b/docs/greenfield-development.md @@ -1,3 +1,4 @@ + # GreenField API Development Documentation ## Adding new API endpoints @@ -11,8 +12,22 @@ * `PATCH` - Update partially * `DELETE` - Delete or Archive * When returning an error response, we should differentiate from 2 possible scenarios: - * Model validation - an error on the request was found - [Status Code 422](https://httpstatuses.com/422) with the model [ValidationProblemDetails](https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.validationproblemdetails?view=aspnetcore-3.1). - * Generic request error - an error resulting from the business logic unable to handle the specified request - [Status Code 400](https://httpstatuses.com/400) with the model [ProblemDetails](https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.problemdetails?view=aspnetcore-3.1). + * Model validation - an error or errors on the request was found - [Status Code 422](https://httpstatuses.com/422) with the model: + ```json + [ + { + "path": "prop-name", + "message": "human readable message" + } + ] + ``` + * Generic request error - an error resulting from the business logic unable to handle the specified request - [Status Code 400](https://httpstatuses.com/400) with the model: + ```json + { + "code": "unique-error-code", + "message":"a human readable message" + } + ``` ## Updating existing API endpoints