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

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant