go-xsd-validate icon indicating copy to clipboard operation
go-xsd-validate copied to clipboard

StructError to include the full path

Open gkoutsoumpakis-form3 opened this issue 1 year ago • 5 comments

When investigating the reason that a large XML failed the validation, looking at only the NodeName might not be enough since there can be too many elements with the same name, for example address.

At the same time, while the error message contains the actual value, so it could be used to identify where the issue lies, it may not be possible to log since that might contain sensitive data.

For that reason a new field is added in StructError that contains the full path to the node that fails the validation. This is reported in reverse order for easier string concatenation. For example: child1<element1<root

gkoutsoumpakis-form3 avatar Oct 12 '22 14:10 gkoutsoumpakis-form3