Skip to content

feat: add client side events#5

Merged
cdavernas merged 2 commits intomainfrom
feat-add-client-side-events
Mar 13, 2026
Merged

feat: add client side events#5
cdavernas merged 2 commits intomainfrom
feat-add-client-side-events

Conversation

@cdavernas
Copy link
Copy Markdown
Member

This pull request introduces a new client-side event and error model for the A2UI framework, including strongly typed records for actions, errors, and events, along with custom JSON serialization logic and comprehensive unit tests. These changes enable structured communication from the UI to backend components, supporting validation, error reporting, and user actions in a consistent and extensible way.

Client-side event and error model

  • Added new records: ClientSideEvent, ClientSideAction, ClientSideError (abstract), ClientSideGenericError, and ClientSideValidationError to represent UI-triggered events and errors, including validation-specific details and error codes. (src/A2UI.Core/ClientSideEvent.cs, src/A2UI.Core/ClientSideAction.cs, src/A2UI.Core/ClientSideError.cs, src/A2UI.Core/ClientSideGenericError.cs, src/A2UI.Core/ClientSideValidationError.cs) [1] [2] [3] [4] [5]
  • Introduced event records: ClientSideActionEvent and ClientSideErrorEvent for reporting user actions and errors from the UI. (src/A2UI.Core/Events/ClientSideActionEvent.cs, src/A2UI.Core/Events/ClientSideErrorEvent.cs) [1] [2]

Serialization and specification support

  • Implemented custom JSON converters for client-side events and errors (JsonClientSideEventConverter, JsonClientSideErrorConverter) to handle polymorphic serialization/deserialization. (src/A2UI.Core/Serialization/Json/JsonClientSideEventConverter.cs, src/A2UI.Core/Serialization/Json/JsonClientSideErrorConverter.cs) [1] [2]
  • Registered new types in JsonSerializationContext for source generation and serialization support. (src/A2UI.Core/Serialization/Json/JsonSerializationContext.cs)
  • Added ErrorCodes static class to expose default error codes for client-side processing. (src/A2UI.Core/A2UISpecificationDefaults.cs)

Testing

  • Added unit tests to verify serialization/deserialization of client-side errors and events. (tests/A2UI.UnitTests/Cases/Core/ClientSideErrorTests.cs, tests/A2UI.UnitTests/Cases/Core/ClientSideEventTests.cs) [1] [2]

Versioning

  • Updated the project version prefix to 0.2.0 to reflect the introduction of these new features. (src/A2UI.Core/A2UI.Core.csproj)

@cdavernas cdavernas self-assigned this Mar 13, 2026
@cdavernas cdavernas requested a review from JBBianchi as a code owner March 13, 2026 10:00
@cdavernas cdavernas merged commit 9ae2b33 into main Mar 13, 2026
1 check passed
@cdavernas cdavernas deleted the feat-add-client-side-events branch March 13, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant