Open brianpos opened 5 years ago
hi @brianpos, there is a good reason we are just returning a string with the position instead of an annotation with a reference to the ITypedElement. This would trie the lifetime of your instance data to the lifetime of the OperationOutcome, which is probably unexpected - certainly because this link would be hidden behind an Annotation:
OperationOutcome validateBigBundle()
{
var validator = new Validator(....);
var bigBundle = <load that bundle from database or file>;
return validator.Validate(bigBundle);
// memory for big instance will NOT be freed!
}
I do feel this could be really useful - but maybe we need to only do that based on a setting. At least the caller is then aware this is happening....
We need to finalize the design on how error messages can be made more user friendly
.net validator should put the ITypedElement as an IAnnotation into the Error.Info.Location property, this will then provide direct access to the value in the code where it was going on, and also the structure definition for the element. And with the new coding that I added into the issue component (which could also use the Annotation to link in the invariant itself too), there is now enough information to reconstruct the error message for translations, or making them just more human friendly in a server before returning.