I love the validation in WOLips. It catches a lot of stuff that
went undetected in WebObjects Builder. However, I'm still not sure
I understand fully the validation options. In particular the
following:
[√ ] ... Warn if Missing Key on NSDictionary/NSArray
If an NSDictionary is supposed to hold any key in there, how can
WOLips do validation if it doesn't know what keys are inside the
dictionary until at run-time? Or am I interpreting this wrong? :-)
You are correct. Almost every class in WO implements NSKVC, which
makes validation a bit of a black art ... Technically speaking, you
can't validate almost any class in WO, but it turns out that MOST of
the time people aren't just binding willy-nilly with dynamically
generated KVC. There are, however, several cases that we can't
possibly deal with. NSDictionary and NSArray are two of the
particularly common ones. As a result there are explicit options to
allow you to turn off these checks. By default, they are warnings --
essentially telling you that if you are choosing to bind to this, the
validator is warning you that you're on your own. That's the intent
of the warning here -- you need to pay attention a little more
closely. In wod files, you can actually add a "// VALID" on the end
of any line to hint to the validator that it doesn't need to warn or
error ... For exampe:
MyString : WOString {
value = someDictionary.name; // VALID
}
will tell the validator to ignore errors/warnings. This is sort of
heavy-handed, because it turns it off for everything on the line, so
if you spell "someDictionary" wrong (which we CAN validate) it won't
tell you. But it's sometimes better than nothing. Currently there is
no equivalent to // VALID for inline bindings, because nobody has been
able to suggest a markup that won't affect runtime.
But the error is telling me that there is no folderID in it. So
which validation option is supposed to get rid of this error?
Basically, I don't want the validation to try to determine whether
or not a key is valid when the target object to which the key is
being applied is of type NSKeyValueCodingAdditions. :-)
And this is where the rub is ... Like I mentioned above, EVERY class
in WO is NSKVC, so you don't ACTUALLY want this most of the time. In
this case, I would probably use // VALID, unless there are tons of
them, in which case if this is a common keypath on your components,
you can setup a binding validation rule (see WOLips prefs=>Binding
Validation Rules), which allow you to setup regular expressions for
keypaths that should always be considered valid. You can see some
default examples in there.
ms
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]