Skip to content

CPP validation library#655

Open
wrenj wants to merge 5 commits intomainfrom
cppv
Open

CPP validation library#655
wrenj wants to merge 5 commits intomainfrom
cppv

Conversation

@wrenj
Copy link
Collaborator

@wrenj wrenj commented Feb 23, 2026

No description provided.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a C++ validation library for A2UI JSON payloads, including comprehensive checks for schema adherence, component integrity, topology, and recursion limits. The implementation is well-structured with good separation of concerns and is accompanied by a thorough set of unit tests. My review focuses on improving code clarity, maintainability, and performance in the C++ implementation, as well as a minor correction in the documentation. The core logic is sound, and the suggestions aim to refine the implementation.


for (const auto& comp : components) {
auto id_it = comp.find(ID);
if (id_it == comp.end() || !id_it->is_string()) continue;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the id isn't a string, isn't that a validation failure?

There not being any IDs might also be a failure, although that's less clear. It's probably "valid" to have an empty updateComponents message, although I'd argue we should disallow that on efficiency grounds.

dfs(ROOT);
}

std::unordered_set<std::string> orphans;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When streaming, it's allowable to send updateComponents messages that don't include a root yet. You can later send one more that includes a root.

Those earlier messages won't validate because they will all be orphans until the root component arrives.

You should probably skip the orphan check (and maybe other topology checks) until you have seen a root component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants