An open API service indexing awesome lists of open source software.

https://github.com/tommaple/result

An abstraction which contains the value or the error of the operation. It can be mapped to the HTTP reponse if needed.
https://github.com/tommaple/result

csharp csharp-lib csharp-library dotnet dotnet-core result rfc-7807 rfc-9457

Last synced: 8 months ago
JSON representation

An abstraction which contains the value or the error of the operation. It can be mapped to the HTTP reponse if needed.

Awesome Lists containing this project

README

          

# Result
An abstraction which contains the value or the error of the operation. It can be mapped to the HTTP reponse if needed.

# Project status: EARLY STAGE

# Why
I decided to create a new implementation to address a few missing functionalities in other libraries (e.g., i18n, support for more precise error descriptions) and to better follow industry standards ([RFC 9457](https://datatracker.ietf.org/doc/html/rfc9457)).

# Error Response
Example
```json
{
"type": "https://example.com/probs/out-of-credit",
"status": 400,
"title": "You do not have enough credit.",
"detail": "Your current balance is 30, but that costs 50.",
"instance": "/accounts/12345/msgs/abc",
"errors": [
{
"pointer": "#/age",
"detail": "must be a positive integer",
"detailTemplate": {
"messageId":"user.details.age.mustBePositive"
}
},
{
"pointer": "#/profile/colour",
"detail": "must be ‘green’, ‘red’ or ‘blue’",
"detailTemplate": {
"messageId": "user.profile.colour",
"params": {
"validValueIds": [
"user.profile.colour.green",
"user.profile.colour.red",
"user.profile.colour.blue"
]
}
}
}
],
"detailTemplate": {
"messageId": "user.account.balance.tooLow",
"params": {
"errorCode": "UAB17",
"accounts": [
{
"title": "Main (***9456)",
"url": "/accounts/12345"
},
{
"title": "Main (***3357)",
"url": "/accounts/67890"
}
],
"currentBalance": 30,
"requiredBalance": 50
}
},
"location": "252e0b7f-b21c-44ab-bda0-c72fe943b886"
}
```

# Contribution
Please contact author: tom.maple(at)outlook.com