-
Notifications
You must be signed in to change notification settings - Fork 9
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
Engine support for constraint
, required
validation
#154
Engine support for constraint
, required
validation
#154
Commits on Jul 12, 2024
-
Initial engine/client API for
constraint
/required
validationAs discussed in #140 Based on 4c38a22, with some refinements: - Each condition’s validity state is now represented by `valid: boolean` - Minor naming adjustments - Nailed down an initial pair of message constants for engine-fallback messages - Added a method to check whether a message is an engine-fallback, in a way that allows type narrowing and produces those message constants as types - Added a ton of JSDoc documentation clarifying the design, expected usage, some anticipated performance caveats, etc
Configuration menu - View commit details
-
Copy full SHA for 9ff8fda - Browse repository at this point
Copy the full SHA 9ff8fdaView commit details -
Expand text definitions to support constraintMsg, requiredMsg
Note: as described in the included TODO.md, this begins moving some parsing logic into a dedicated directory. This is a direction I’d wanted to take for some time. It felt particularly appropriate now because parsing these aspects of text no longer fits in the current body directory (itself entirely concerned with parsing, but only implicitly so), and it felt particuarly awkward to introduce another parsing-related top-level source directory (moving further *away* from this intent rather than inching towards it). I’d like to consider moving the rest of parsing logic into this directory within the same PR. It will almost certainly be just moving files and updating imports from here (and then TODO.md will never need to appear).
Configuration menu - View commit details
-
Copy full SHA for beb4d38 - Browse repository at this point
Copy the full SHA beb4d38View commit details -
Configuration menu - View commit details
-
Copy full SHA for 96a9921 - Browse repository at this point
Copy the full SHA 96a9921View commit details -
Configuration menu - View commit details
-
Copy full SHA for e94c389 - Browse repository at this point
Copy the full SHA e94c389View commit details -
Initial constraint/required implementation (value nodes)
Note: this is intentionally a naive first pass! It does not defer computation as extensively as it could. I believe it is worth having that possibility documented, but measuring real world performance before optimizing further.
Configuration menu - View commit details
-
Copy full SHA for cf34554 - Browse repository at this point
Copy the full SHA cf34554View commit details -
Initial aggregated violations implementation (ancestor nodes)
Note: this is also a naive first pass! Aggregated results are not stored in a client state object, but rather computed up from leaf nodes (where both engine/client state are read to ensure reactivity on both sides of that boundary).
Configuration menu - View commit details
-
Copy full SHA for 5cbfb62 - Browse repository at this point
Copy the full SHA 5cbfb62View commit details -
Fix: special case casting of boolean expressions which evaluate to si…
…ngle node node-set This affects some `scenario` validation tests. It will also fix a few other tests which currently fail because of this difference in XPath/XForms boolean semantics (details in JSDoc).
Configuration menu - View commit details
-
Copy full SHA for ac20ff5 - Browse repository at this point
Copy the full SHA ac20ff5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9b9efc5 - Browse repository at this point
Copy the full SHA 9b9efc5View commit details -
Configuration menu - View commit details
-
Copy full SHA for a5f33b2 - Browse repository at this point
Copy the full SHA a5f33b2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 379b339 - Browse repository at this point
Copy the full SHA 379b339View commit details -
Add tests for validation messages
- Form-specified constraintMsg, requiredMsg - Default/fallback messages for both conditions, as provided by the engine
Configuration menu - View commit details
-
Copy full SHA for d583b9f - Browse repository at this point
Copy the full SHA d583b9fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 573b06b - Browse repository at this point
Copy the full SHA 573b06bView commit details -
Fix (quick and dirty): client reactivity of parent node validation state
In theory, we could do something like this to simplify children state logic as well, at least until we have a better general solution to storing/serializing/materializing complex nested state like direct references to node objects. I’d prefer to keep it isolated for now and think about priority of a more holistic solution.
Configuration menu - View commit details
-
Copy full SHA for 9a6fa61 - Browse repository at this point
Copy the full SHA 9a6fa61View commit details -
As we discussed, this can be handled in a separate scope of work. The original commits are left intact for reference, we can rebase before merge if preferred.
Configuration menu - View commit details
-
Copy full SHA for d1acaa6 - Browse repository at this point
Copy the full SHA d1acaa6View commit details -
Remove
node
object from aggregated validation stateAlso eliminates most of the basis for the hacky custom client state solution, and so falls back to `createSharedNodeState`. This still isn’t ideal, as it’s redundantly storing a bunch of state that’s fundamentally derived. Worth considering whether the client interface should also accept an optional derived state factory (e.g. Vue’s `computed`, Solid’s `createMemo`).
Configuration menu - View commit details
-
Copy full SHA for 460f68a - Browse repository at this point
Copy the full SHA 460f68aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 23171c7 - Browse repository at this point
Copy the full SHA 23171c7View commit details -
Scenario: add test for skipping validation of non-relevant nodes (at …
…node and form level)
Configuration menu - View commit details
-
Copy full SHA for a385483 - Browse repository at this point
Copy the full SHA a385483View commit details -
Fix (engine): skip validation of non-relevant nodes
Note: no change to aggregation necessary! Derived state is awesome.
Configuration menu - View commit details
-
Copy full SHA for 200c222 - Browse repository at this point
Copy the full SHA 200c222View commit details