[dotnet] [bidi] Remove enumerable json converter for Input module#17285
Merged
nvborisenko merged 8 commits intoSeleniumHQ:trunkfrom Apr 1, 2026
Merged
[dotnet] [bidi] Remove enumerable json converter for Input module#17285nvborisenko merged 8 commits intoSeleniumHQ:trunkfrom
nvborisenko merged 8 commits intoSeleniumHQ:trunkfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the .NET BiDi Input actions model to remove the custom enumerable JSON converter and rely on System.Text.Json polymorphic serialization, making construction of action sequences explicit via action lists.
Changes:
- Reworked
SourceActionsand concrete action source types (KeyActions,PointerActions, etc.) to take explicitIList<TAction>action lists instead of behaving like enumerables. - Removed the
InputSourceActionsConverterand related enumerableJsonSerializableentries, switching to attribute-based polymorphic serialization. - Updated BiDi Input tests to use the new constructor-based action list API.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| dotnet/test/webdriver/BiDi/Input/CombinedInputActionsTests.cs | Updates test call sites to construct SourceActions with explicit action lists. |
| dotnet/src/webdriver/BiDi/Json/Converters/Enumerable/InputSourceActionsConverter.cs | Removes the now-unneeded custom SourceActions JSON converter. |
| dotnet/src/webdriver/BiDi/Input/SourceActions.cs | Introduces polymorphic serialization attributes and refactors the SourceActions type hierarchy / action record types. |
| dotnet/src/webdriver/BiDi/Input/InputModule.cs | Removes source-gen registrations that were previously needed by the custom converter. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Don't try to mix high-level and DTO serializable behaviour. Be truly low-level.
🔗 Related Issues
Contrinutes to #16095
💥 What does this PR do?
This pull request significantly refactors the BiDi Input Actions model in the .NET WebDriver codebase, simplifying and modernizing the type hierarchy, improving serialization, and updating usages in tests. The changes remove legacy code and custom serialization logic, unify the action type structure, and update tests to use the new model.
Core model and serialization refactor:
SourceActionshierarchy to use modern C# records and type-safe generics, replacing the previous inheritance and interface-based approach. The new structure uses discriminated unions for action types, and moves from mutable collections to immutableIEnumerableproperties. (dotnet/src/webdriver/BiDi/Input/SourceActions.cs, dotnet/src/webdriver/BiDi/Input/SourceActions.csL20-R50)KeySourceActions,PointerSourceActions,WheelSourceActions,NoneSourceActions) to the new structure, and replacedintproperties withlongfor better consistency and range. (dotnet/src/webdriver/BiDi/Input/SourceActions.cs, [1] [2]SequentialSourceActionsand related types, as well as the customInputSourceActionsConverterused for serialization. The new structure relies on built-in polymorphic serialization. (dotnet/src/webdriver/BiDi/Input/SequentialSourceActions.cs, [1];dotnet/src/webdriver/BiDi/Json/Converters/Enumerable/InputSourceActionsConverter.cs, [2]InputJsonSerializerContextby removing unused enumerable serializable types, since they are no longer needed with the new model. (dotnet/src/webdriver/BiDi/Input/InputModule.cs, dotnet/src/webdriver/BiDi/Input/InputModule.csL78-L81)Test updates:
*SourceActionsrecords with immutable lists, and adjusted test logic to match the new API, including more explicit pointer and key action sequences. (dotnet/test/webdriver/BiDi/Input/CombinedInputActionsTests.cs, [1] [2]These changes modernize the codebase, reduce complexity, and improve maintainability for BiDi Input Actions.
References:
[1] [2] [3] [4] [5] [6] [7] [8]
💡 Additional Considerations
Still using
IList, kind of opening doors for Builders. Revisit later.🔄 Types of changes