Skip to content
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

refactor: diff viewer of response #1512

Merged
merged 8 commits into from
Feb 16, 2024
Merged

refactor: diff viewer of response #1512

merged 8 commits into from
Feb 16, 2024

Conversation

shivamsouravjha
Copy link
Contributor

@shivamsouravjha shivamsouravjha commented Feb 6, 2024

Related Issue

  • Info about Issue or bug

Closes: #1518

Describe the changes you've made

Refactored the function.
Used better name for variables and checked for maps as well to show difference in objects.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, local variables)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Please let us know if any test cases are added

Please describe the tests(if any). Provide instructions how its affecting the coverage.

Describe if there is any unusual behaviour of your code(Write NA if there isn't)

A clear and concise description of it.

Checklist:

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

Screenshots (if any)

image

image

image
image
image
image

Copy link
Member

@Sarthak160 Sarthak160 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shivamsouravjha
Copy link
Contributor Author

shivamsouravjha commented Feb 12, 2024

the diff in the cli isn't showing certain fields which should be shown. This is because when array order is changed it will be treated as struct type of diff.movestruct. This struct isn't handled in the switch condition which prints the diff. ascii.go. Thus it goes into the default case where the data(moved) isn't printed and an unhandled error is returned.

Same issue has been raised in this repo as well yudai/gojsondiff#39.

In the above issue the response was this:-

    {
           "bidid": "test bid id",
           "id": "some-request-id",
           "nbr": 0,
           "seatbid": [
             0: {
               "bid": [
                 1: {
                   "id": "rubicon-bid",
                   "impid": "",
                   "price": 0
                 },
                 2: {
                   "id": "appnexus-bid",
                   "impid": "",
                   "price": 0
                 },
               ],
               "seat": "seat-id"
             }
           ]
         }

and this is the difference shown by the tool.
image

The field

2: {
                   "id": "appnexus-bid",
                   "impid": "",
                   "price": 0
                 },

is missing in the diff viewer.

@Sarthak160 Sarthak160 merged commit 7317a66 into main Feb 16, 2024
13 checks passed
@Sarthak160 Sarthak160 deleted the shivam/ranking branch February 16, 2024 06:50
@github-actions github-actions bot locked and limited conversation to collaborators Feb 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactoring diff viewer to display better logs for array index mismatch
2 participants