firely-net-sdk
firely-net-sdk copied to clipboard
Extend ValidationResult class to allow localization/formatting
ValidationResult currently only exposes an ErrorMessage property. This prevents clients from localizing/formatting the error message. Proposal:
- Implement ValidationResult.ErrorId - uniquely identifies each error message The API should expose the available error identifiers as public constants
Advanced:
- Provide access to dynamic error data, e.g. filenames, element names, position etc. so a client can manually format a user-friendly (localized) error message.
Maybe similar implementation to .NET exception classes?
- Expose a generic Data collection that provides access to dynamic error properties
- Implement error-specific subclasses with named properties for specific error properties
Yes this really needs to be done, and a thorough going through all the error messages to make them more user friendly, not just developer friendly. (Such as using the display property from the element definition instead of the path/slice name in the messages) and less intimidating words than instance, cardinality, etc
This issue is about dotnet attribute validation, not the profile validator, so I removed that label
So, the ValidationResult
@wmrutten talks about is this one from the .NET framework: https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.validationresult?view=net-5.0