-
Notifications
You must be signed in to change notification settings - Fork 108
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
No way to error on unknown properties #220
Comments
|
Yes, that's per design! Representable is a document mapper and not a form object. We're actually thinking about allowing the detection of that, since it will also be very helpful in Reform. |
The problem is that this might appear very simple with hashes (as in, find all keys in the incoming doc, compare to what we have), however, with XML documents as an example, this gets much trickier. I am wondering if that should probably be some Reform-specific feature, instead. 🤔 |
Yeah, I was browsing through the source to see if there would be any quick+clean way to patch this in but nothing popped out at me. The current design feels pretty heavy towards not having this feature. Some extremely pragmatic part of me is tempted to just serialize/unserialize and compare the result to see if everything is accounted for. The rest of me is beating the pragmatic part of me down and hoping for a better solution. |
I understand - and I recommend you to check out how we handle that in Trailblazer or directly in Reform, where the form object applies a deserializing representer to itself. The representer per design has no knowledge about validations of any kind, but just parses values it knows to the form. The form then says "that's fine" or marks errors. You can also override |
Given a class:
and some data to instantiate it with:
There is no way to discover that
genre
is about to be harshly ignored or dropped on the ground. Another similar problem with slightly different data:since trach != track, our optional attribute is also silently dropped without warning.
The text was updated successfully, but these errors were encountered: