Skip to content

Repository files navigation

Maple.Result.Extensions.AspNetCore

Maps the Maple.Result to the HTTP response (ASP.NET Core version)

Project status: EARLY STAGE

Check also my libraries:

Give it a star ⭐

Do you like it? Show your support by giving this project a star!

Status

➡️ Basic mapping without configuration.
🔲 Integration tests.
🔲 Configuration passed as a parameter to the extension method.
🔲 Support for global configuration.
🔲 Support for multiple successful codes.
🔲 Support for Created (201) with Location header.
🔲 Documentation.

Example Error Response

Example

{
    "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",
            "detailTemplated": {
                "messageId":"user.details.age.mustBePositive"
            }
        },
        {
            "pointer": "#/profile/colour",
            "detail": "must be ‘green’, ‘red’ or ‘blue’",
            "detailTemplated": {
                "messageId": "user.profile.colour",
                "params": {
                    "validValueIds": [
                        "user.profile.colour.green",
                        "user.profile.colour.red",
                        "user.profile.colour.blue"
                    ]
                }
            }
        }
    ],
    "detailTemplated": {
        "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
        }
    }

}

See also

Contribution

Please contact author: engineer(at sign)blumail(dot)me

About

Maps the Maple.Result to the HTTP response (ASP.NET Core version)

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages