ardalis / Result

A result abstraction that can be mapped to HTTP response codes if needed.
MIT License
866 stars 107 forks source link

errorMessages should be passed as string #124

Open buti1021 opened 1 year ago

buti1021 commented 1 year ago

The error messages get translated into the details property of the problem details object. By the RFC standard this property is a string. Currently a list of errormessages can be passed to the NotFound and Error Method, which then get concatenated. e.g.,: https://github.com/ardalis/Result/blob/1c8a9f53b8995e82af0b1650b5c83ec15060289a/src/Ardalis.Result.AspNetCore/ResultStatusMap.cs#L117-L120 This breaks internationalization, as the string at the start is english and already happens if only a single string is passed. I think the best approach would be to allow only strings and make the developer responsible for concatenation. What do you think? @ardalis @KyleMcMaster

ardalis commented 5 months ago

Related to #126.

We need a better story for managing strings and internationalization.

LouisTrinczek commented 2 weeks ago

I think there shouldn't be more than one error, per ProblemDetails instance. Is there a common approach in dotnet, to returning a list of multiple ProblemDetails?

Because then the developer could work with a list of ProblemDetails, and concatenate the errors himself, and also translate it by himself how he sees fit using only the actual error message, he defined returned from the ProblemDetails.Detail field.

I am facing the internationalization error myself right now working with this package.