-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Added selection of compare mode for Json #897
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are breaking changes.
If you want to introduce something like this, you will have to introduce overloaded methods that accept the new method argument, keeping the existing signatures in tact.
|
Please create a JIRA issue requesting this improvement. |
|
Also, have you signed the Spring Individual Contributor License Agreement (ICLA)? |
|
Thanks for your comments. I add sign of Spring Individual Contributor License Agreement (ICLA) to my initial comment. Also I create issue in JIRA I created changes that breaks API, because I got a problem with tests, which does not breaks, when my API accidentally has changed. So the default comparison mode is very error prone. And I think that by removing "default method" we remove oportunity for developers to go in a wrong way. Also this problem can be solved by setting So on my opinion, the better way is to break API, so when compilation fails, developers can find what goes wrong faster. Sorry for my bad english I hope you understand what I try to explain=) |
|
@Hronom: as said by Sam, you should introduce overloaded methods instead of making those breaking API changes. Maybe you could update Would introducing a @sbrannen Any thoughts about exposing |
|
As discussed with @jhoeller during our weekly meeting, it would be nice to only add the |
|
Looks like |
|
I merged a polished version of your commit that also avoid to break current API. |
Greetings everyone!
spring-testfor comparing json use external library calledjsonassert.This lib has several mods of comparing json:
STRICT- Strict checking. Not extensible, and strict array ordering.LENIENT- Lenient checking. Extensible, and non-strict array ordering.NON_EXTENSIBLE- Non-extensible checking. Not extensible, and non-strict array ordering.STRICT_ORDER- Strict order checking. Extensible, and strict array ordering.By default
spring-testin methodorg.springframework.test.web.servlet.result.ContentResultMatchers#jsonuse this library in modLENIENT.This mod is not strict enough. In situation when in your json new field has added, your tests not failed, so app that use API with this json can crash when try to deserialize this in some POJO!
Also this is not acceptable, when you want compare json in other useful mods, for example
NON_EXTENSIBLE.I have added changes and for now, developer can select mod that he want.
Issue: SPR-13607
I have signed and agree to the terms of the Spring Individual Contributor
License Agreement.