[dotnet] Obsolete setters and constructors on Response
that are not conducive to immutability #15107
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.
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
Obsolete every constructor on
Response
besides the one which sets all values. Obsolete public setters onResponse
properties.Motivation and Context
A programmatic guarantee of immutability would be a conceptual simplification, because it allows us to make assumptions and guarantees we could not otherwise make.
For example, in the future we could expose
JsonNode? ValueAsNode
property which would allow us to manage the response as a strongly-typed node instead of knowing ahead of time what the types could be.Types of changes
Checklist
PR Type
Enhancement, Other
Description
Marked constructors and setters in
Response
as obsolete.Introduced warnings for deprecated
Response
members.Updated
HttpCommandExecutor
to handle obsoleteResponse.Value
setter.Prepared
Response
class for immutability in future releases.Changes walkthrough 📝
HttpCommandExecutor.cs
Suppress warnings for obsolete `Response.Value` setter
dotnet/src/webdriver/Remote/HttpCommandExecutor.cs
Response.Value
setter.CreateResponse
method to handle deprecatedResponse.Value
.Response.cs
Mark `Response` constructors and setters as obsolete
dotnet/src/webdriver/Response.cs
Value
,SessionId
, andStatus
as obsolete.