Validation rules, add/edit, and SET #84
bryanburgers
started this conversation in
General
Replies: 1 comment 2 replies
-
Thanks for posting. Here are some examples of real world rules that require set behavior (mutation):
This is an example of
This would be a
This is similar to (2).
This uses |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
While working on a few Add/Edit projects, I've been familiarizing myself with the existing validation rules spec. My goal is to use the validation rules spec to provide a good user experience for agents — especially, give agents immediate feedback on validation and provide lookup winnowing.
As part of this, I keep coming across the same question and I would love to hear some MLS and MLS Provider thoughts and context on the
SET
part of the spec.For reference, here's some places to find validation rules information:
In these resources, the importance of data mutation (especially via
SET
) is implied.Key questions:
SET
action?SET
rules?If the Rules Resource is viewed through the lens of a communication mechanism between the server (MLS provider, on behalf of the MLS) and the client (and Add/Edit application), the Rules Resource is communicating what the server intends to do with the information provided. In that context, I understand what most of the actions are communicating:
ACCEPT
rule is communicating to the client that if the client sends a value such that the expression doesn't evaluate to true, the server will not apply the change.REJECT
rule is communicating largely the same: if the client sends a value such that the expression does evaluate to true, the server will not apply the change.SET_REQUIRED
rule is communicating that if the client does not send a value for the field, the server will not apply the change.SET_PICKLIST
andRESTRICT_PICKLIST
are a little less to the point, but I think they can reasonably be interpreted as communicating that if the client sends a value that is not included in the new calculated list of lookup items, the server will not apply the change.On the other hand, the
SET
rule is ambiguous about what the server is communicating. If a server includes aSET
rule, what exactly is the server trying to communicate to the client? I can see several different options of what is trying to be communicated, and I'm curious if there's consensus on this?Does a
SET
rule communicate from the server to the client:As an example, let's assume a client receives a
SET
rule on the fieldOnMarketDate
that looks like:The intention of this
SET
rule makes sense: when a listing transitions from a status of Draft to any other status, theOnMarketDate
should be set to the current date. In all other circumstances, don't change theOnMarketDate
.What's not clear is what a client that sees this rule should send
OnMarketDate
itself anyway."OnMarketDate": "2023-05-09"
. If it doesn't, the server will not apply this change."OnMarketDate": "2023-05-09"
. The server won't actually verify this though. (Hopefully the client and the server are in the same timezone and have synchronized clocks.)As an MLSes or an MLS Provider, in the context of Add/Edit, what are you communicating when you send a
SET
rule in the Rules Resource?Beta Was this translation helpful? Give feedback.
All reactions