Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ITypedElement cannot represent incorrect primitive data #2855

Open
ewoutkramer opened this issue Sep 10, 2024 · 0 comments
Open

ITypedElement cannot represent incorrect primitive data #2855

ewoutkramer opened this issue Sep 10, 2024 · 0 comments

Comments

@ewoutkramer
Copy link
Member

I switched the parser in our validator demo to "Ostrich", so that we would get more errors reported from the validator (e.g. cardinality) instead from the parser. However, when I changed a date to be incorrect, an exception was caught. It turns out (and this is by design at this point) that ITypedElement.value cannot represent incorrect values (e.g. when dealing with a date, the type has to be DateTime), so PocoElementNode's internal object ToITypedElementValue() crashes, as it actually tries to read the Value property of the poco, not the ObjectValue.

This is unnecessary: the user is passing a POCO to the validator (which can represent incorrect data), but it then crashes just because we do still need to feed tha validator an ITypedElement. This proves the point that we should move forward to using POCO's rather than ITypedelement and/or make it possible to feed original unparsed data via ITypedElement to the validator. Since that would violate the contract for ITypedElement.Value, it's not clear how we should do that.

But it is clear that our trick of wrapping POCO's in ITypedElement does still have its disadvantage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants