-
Notifications
You must be signed in to change notification settings - Fork 661
proposal: Introduce validation framework and data protocol enhancements #438
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
Conversation
6eaa551 to
f492b4d
Compare
jacobsimionato
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m still worried about overall complexity, but I like the feel of the concepts here, e.g the name DynamicString etc seems to be approaching the level of genericness that we we need.
I wonder if there is a set of validation functions to include in the standard catalog?
Also, guidance on how validation functions are treated UX wise. E.g if you have a text field with multiple validations combined with AND and they all fail, is the UI supposed to display all the failure messages together etc?
| **Properties:** | ||
|
|
||
| - `supportedCatalogIds` (array of strings, required): URIs of supported component catalogs. | ||
| - `supportedFunctionCatalogIds`: A list of URIs for the function catalogs supported by the client. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it make sense to put them in the same catalog document? I figure if both the functions and components are typically in well-known catalogs identified by ID, then they may as well be combined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it could, but I figured that this gives the ability to have different profiles. For instance, you could have a "US" set of validation functions and a "Euro" set and swap them out by using different URIs instead of having to compose a new component catalog with different rules.
That doesn't preclude combining them though. We could just have a "package" concept where a package could include any combination of components and functions.
(Woohoo! I just realized that means we could mark "design a package manager" on our "don't ever do that" bingo card! And right after we had to put down "Design a new standard". We're on a roll! Now all we need to do is design a build system and we win!)
There is a set of standard ones in this PR that I thought would be a good starting point (regex, length, numeric, and email). |
Description
This PR introduces a comprehensive validation framework for the A2UI v0.9 specification and includes significant updates to the protocol definition to simplify data operations, enhance dynamic value capabilities, and formalize client-side validation logic.
Key Changes
Protocol Updates
opfield fromupdateDataModel. The operation is now implicit: presence ofvalueimplies an update/create operation, while its absence implies a removal. This reduces payload size and complexity.*OrPathtypes toDynamic*(e.g.,DynamicString,DynamicNumber) and introduced support forFunctionCallwithin these types. This allows for complex, client-side evaluated expressions in property bindings.clientUiCapabilitiesto theclient_to_server.jsonschema, allowing clients to advertise supported component catalogs, check catalogs, and inline functions.Client-Side Logic & Validation
LogicExpressionandCheckRule. This enables robust client-side validation (e.g., form field checks) using composable boolean logic (and,or,not) and function calls.Checkableinterface incommon_types.json, allowing components to define a list of validationchecksthat must pass.returnTypevalidation for all function calls within dynamic types to ensure type safety at the schema level.Validation Framework
specification/0.9/test/cases/*.json) to rigorously validate schema correctness.Documentation
Verification
python3 specification/0.9/test/run_tests.py