Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Valid body doesn't get diff of added properties #23

Open
artem-zakharchenko opened this issue Aug 12, 2019 · 2 comments
Open

Valid body doesn't get diff of added properties #23

artem-zakharchenko opened this issue Aug 12, 2019 · 2 comments

Comments

@artem-zakharchenko
Copy link
Contributor

Scenario

Whenever a body field is valid, even if an actual field has additional properties, those properties are not highlighted as added.

{
  "expected": { "login": "admin" },
  "actual": { "login": "joe", "newProp": true }
}

The newProp property won't be shown as the added one (green).

Expected behavior

Any property that is present in the actual HTTP message field (i.e. body, headers), but is not specified in the expected HTTP message field must be highlighted as the added one.

@artem-zakharchenko
Copy link
Contributor Author

artem-zakharchenko commented Aug 12, 2019

To clarify: if a body is invalid (i.e. there is a missing property in the actual body), then the new properties are highlighted as green. At first glance it looks like gavel2html skips the diff is a field is valid.

@artem-zakharchenko
Copy link
Contributor Author

Here's the cause in the source code:

#@private
getErrorsFromResults: () ->
if @fieldResult.errors.length == 0
return [] # not sure about this, added keys will not be marked as added

Even the comment suggest there will be an issue, since the diff'ing is skipped when there are no errors.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant