-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[dotnet] Nullable value in dictionary for json preparation #17087
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
[dotnet] Nullable value in dictionary for json preparation #17087
Conversation
PR TypeEnhancement Description
|
| Relevant files | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Enhancement | 16 files
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
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.
Pull request overview
Updates the .NET WebDriver command-parameter dictionaries to allow nullable values, aligning the parameter types with scenarios where JSON payloads may legitimately include null.
Changes:
- Switches many command
parametersdictionaries fromDictionary<string, object>toDictionary<string, object?>. - Updates
WebDriver.Execute(...)/ExecuteAsync(...)to accept nullable dictionary values (object?) and nullable parameter dictionaries. - Adjusts several public APIs (
ExecuteCustomDriverCommand,ExecuteCdpCommand, andToDictionary()methods) to reflect nullable dictionary values.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/src/webdriver/Window.cs | Uses Dictionary<string, object?> for window rect command parameters. |
| dotnet/src/webdriver/WebDriver.cs | Updates Execute/ExecuteAsync and various call sites to nullable dictionary values. |
| dotnet/src/webdriver/VirtualAuth/VirtualAuthenticatorOptions.cs | Changes ToDictionary() to return Dictionary<string, object?>. |
| dotnet/src/webdriver/VirtualAuth/Credential.cs | Changes ToDictionary() to return Dictionary<string, object?>. |
| dotnet/src/webdriver/Timeouts.cs | Uses Dictionary<string, object?> for timeout command parameters. |
| dotnet/src/webdriver/TargetLocator.cs | Uses Dictionary<string, object?> for switch-to frame/window command parameters. |
| dotnet/src/webdriver/ShadowRoot.cs | Uses Dictionary<string, object?> for shadow root find-element(s) parameters. |
| dotnet/src/webdriver/Safari/SafariDriver.cs | Uses Dictionary<string, object?> for permissions command parameters. |
| dotnet/src/webdriver/Remote/RemoteWebDriver.cs | Uses Dictionary<string, object?> for download command parameters. |
| dotnet/src/webdriver/Navigator.cs | Uses Dictionary<string, object?> for navigation command parameters. |
| dotnet/src/webdriver/Logs.cs | Uses Dictionary<string, object?> for log retrieval parameters. |
| dotnet/src/webdriver/ICustomDriverCommandExecutor.cs | Updates public interface method to accept Dictionary<string, object?>. |
| dotnet/src/webdriver/Firefox/FirefoxDriver.cs | Uses Dictionary<string, object?> for several Firefox custom commands. |
| dotnet/src/webdriver/CookieJar.cs | Uses Dictionary<string, object?> for cookie commands (and empty parameter dictionaries). |
| dotnet/src/webdriver/Chromium/ChromiumDriver.cs | Updates CDP command APIs and parameters to object? values. |
| dotnet/src/webdriver/Alert.cs | Uses Dictionary<string, object?> for alert text parameters. |
This change improves type safety and better reflects scenarios where dictionary values may be null.
💥 What does this PR do?
Enable nullability for
driver.Execute.🔄 Types of changes