JSON comparison parity (utility only)#401
Merged
timkimadobe merged 8 commits intoadobe:feature/json-comparison-parityfrom Sep 19, 2023
Merged
Conversation
Update documentation and code logic to match Android implementation
This reverts commit 7f38d19.
Codecov Report
@@ Coverage Diff @@
## feature/json-comparison-parity #401 +/- ##
===============================================================
Coverage 96.77% 96.77%
===============================================================
Files 27 27
Lines 1671 1671
===============================================================
Hits 1617 1617
Misses 54 54 |
emdobrin
reviewed
Sep 19, 2023
Contributor
emdobrin
left a comment
There was a problem hiding this comment.
thanks for porting these changes over
emdobrin
reviewed
Sep 19, 2023
| /// 3. The general wildcard: [*] (must be in exactly this format) - Every element not explicitly specified by 1 or 2 will use the alternate mode and apply wildcard matching logic. This option is mututally exclusive with default behavior. | ||
| /// - The default behavior is that elements from the expected JSON side are compared in order, up to the last element of the expected array. | ||
| /// For wildcard array matching, where position doesn't matter: | ||
| /// 1. Specific index with wildcard: `[*<INT>]` or `[<INT>*]` (ex: `[*1]`, `[28*]`). The element |
Contributor
There was a problem hiding this comment.
will you add new tests for the wildcard index matches similar to Android in the next PRs?
Contributor
Author
There was a problem hiding this comment.
Yes, they will be included in a followup PR!
Update param name of extractArrayStyleComponents to be more intuitively descriptive
timkimadobe
commented
Sep 19, 2023
Contributor
Author
timkimadobe
left a comment
There was a problem hiding this comment.
Thanks so much for the review @emdobrin! Updated based on feedback and will open the corresponding test updates PR as a followup to this one
| /// 3. The general wildcard: [*] (must be in exactly this format) - Every element not explicitly specified by 1 or 2 will use the alternate mode and apply wildcard matching logic. This option is mututally exclusive with default behavior. | ||
| /// - The default behavior is that elements from the expected JSON side are compared in order, up to the last element of the expected array. | ||
| /// For wildcard array matching, where position doesn't matter: | ||
| /// 1. Specific index with wildcard: `[*<INT>]` or `[<INT>*]` (ex: `[*1]`, `[28*]`). The element |
Contributor
Author
There was a problem hiding this comment.
Yes, they will be included in a followup PR!
emdobrin
approved these changes
Sep 19, 2023
10 tasks
timkimadobe
added a commit
that referenced
this pull request
Oct 12, 2023
* JSON comparison parity (utility only) (#401) * Remove custom helper enums and refactor usages Update documentation and code logic to match Android implementation * Apply lint autocorrect * Revert "Apply lint autocorrect" This reverts commit 7f38d19. * Apply lint autocorrect * Reduce wordiness of file and line param descriptions * Update documentation null to nil * Update file and line param descriptions * Add method documentation to all helper methods Update param name of extractArrayStyleComponents to be more intuitively descriptive * JSON comparison parity - test cases (#402) * Achieves parity with the Android Edge test setup for JSON comparison Splits coverage into parameterized and special case tests, and update provides more comprehensive systematic coverage * Add additional test cases to validate type mismatch detection and all boolean cases Update index helper comments based on changed values * Update failure cases to check for unintended type casting * Fix comment typo * Extract inline actual AnyCodable creation to separate line for clarity * Refactor wildcard index logic (#416) * Refactor wildcard index access to flatten logic since different condition and replacement groups are not needed * Reformat method documentation to bring them all together * Rename variables to better reflect what each one stores * Refactor wildcard array index extraction to strictly validate format Extract wildcard array index extraction logic into separate function Update usages, test cases, and method documentation * Update test failure message to include example format * Rename `extractArrayStyleComponents` and update method docs (#418) * Rename the extractArrayStyleComponents -> extractArrayFormattedComponents to better reflect actual behavior Update method documentation to reflect the rename and to better explain the logic * Update parameter description * Update method description * Include information about removing escape character
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR updates the JSON comparison system to be in line with the Android implementation, taking the following improvements:
[*]overrides all other alternate paths[*]> specific index[0]> unspecified index (no alternate path) > wildcard index[*0]getAnyCodableAndPayloadin favor of usingAnyCodable's dictionary representation directlyAssertModeandPayloadTypeenumsFor reference, please see the Android implementation: adobe/aepsdk-edge-android#79
Note that the unit and parameterized tests are not implemented in this PR to facilitate easier review process and will be implemented in followup PRs
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: