-
Notifications
You must be signed in to change notification settings - Fork 920
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
[CodeHealth] Simplifying json parsing - pt.4 #27884
base: master
Are you sure you want to change the base?
Conversation
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.
components/skus/renderer lgtm
std::string json = R"([])"; | ||
auto result = simple_hash_client_->ParseNFTsFromSimpleHash( | ||
base::test::ParseJsonDict(json), true, false); | ||
ASSERT_FALSE(result); |
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.
I think we don't need to test non-dict inputs as it is validated by caller now
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.
Done. Thanks.
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.
wallet core lgtm
This PR simplifies JSON reading in several places by: - Using `base::JSONReader::ReadDict` - Using `base::JSONReader::ReadList` - Using `base::test::ParseJson*` This changes aim to make the checks around the parsing and its expectations simpler to read.
69fda71
to
28c5b7f
Compare
[puLL-Merge] - brave/brave-core@27884 DescriptionThis PR updates the codebase to use the new Value API in Chromium's base library, specifically transitioning from the older JSONReader::Read() to the newer base::test::ParseJson() and JSONReader::ReadDict() methods. The changes are focused on modernizing JSON parsing across several Brave components and improving type safety. ChangesChanges
sequenceDiagram
participant App
participant JSONParser
participant Dict
App->>JSONParser: ReadDict(json_string)
alt Invalid JSON
JSONParser-->>App: Return nullopt
else Valid JSON
JSONParser->>Dict: Create Dictionary
Dict-->>App: Return Dict
end
App->>Dict: Access Values
Dict-->>App: Return Typed Values
DetailsThe key changes involve:
|
This PR simplifies JSON reading in several places by:
This changes aim to make the checks around the parsing and its expectations simpler to read.
Resolves
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: