Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd JSON object comparision #924
Comments
lwasylow
self-assigned this
May 21, 2019
lwasylow
added
the
enhancement
label
May 21, 2019
lwasylow
added this to the v3.1.7 milestone
Jun 17, 2019
lwasylow
closed this
Jun 17, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lwasylow commentedMay 21, 2019
•
edited
Since JSON is gaining a popularity and since Oracle 12.2 we got a proper support of JSON in database I thought it would b a good idea to implement a JSON comparison matcher.
I've did some initial work for cursor equality and will be adding a more methods. Here is a sample test and results.
Running matcher:
select * from table(ut.run('ut_sample_test'));gives:
I will be adding a more comparison method so far I think about adding
have_count(json_path)
*For a scalar, it returns 1.
*For an object, it returns the number of keys.
*For an array, it returns the number of items.
include(a_json_path)
exclude(a_json_path)
is_null
is_empty
Optionally maybe we could add some option to limit part e.g.
ut.expect(a_json).extractjson(json_path).to_equal(e_json).extractjson(different_json_path)This is not replacement to
include / excludebecause each part can have a different extract paths.If you have any comments or a good resources with a samples complex json to run through tests would be appreciated.