14035: Add 'toJson' method to produce expected serialization#14038
14035: Add 'toJson' method to produce expected serialization#14038diemol merged 3 commits intoSeleniumHQ:trunkfrom
Conversation
PR Review 🔍
|
PR Code Suggestions ✨
|
…mHQ#14038) Co-authored-by: Puja Jagani <puja.jagani93@gmail.com> Co-authored-by: Diego Molina <diemol@users.noreply.github.com>
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
The standard Rectangle class (
org.openqa.selenium.Rectangle) lacks atoJson()method, which causes the serialization performed by the Json API to fall back to scanning for methods that look like JavaBean accessors to extract object properties. In addition to the methods that provide access to inherent properties (width,height,x, andy), the Rectangle class provides two methods that produce derived properties (dimensionandpoint). Consequently, the JSON current returned for Rectangle objects includes these derived properties as well.Motivation and Context
Fixes #14035
Types of changes
Checklist
PR Type
Enhancement
Description
toJsonmethod to theRectangleclass to produce expected JSON serialization.toJsonmethod includes thewidth,height,x, andyproperties in the JSON output.Mapclass to facilitate JSON serialization.Changes walkthrough 📝
Rectangle.java
Add `toJson` method for JSON serialization in `Rectangle` class.java/src/org/openqa/selenium/Rectangle.java
toJsonmethod to serializeRectangleobjects.width,height,x, andyproperties in the JSON output.Mapclass for JSON serialization.