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
assertion functions for Json #45
Comments
Another use case is comparing a json against a predefined json:
Meaning we could parse the
I guess failing if there is unexpected data should also be the normal case for
Which we could combine with other options as well.
Does not fail even though |
Maybe we should shorten the syntax and use |
Another way to think about |
@keturn Makes sense if you don't compare against another json. Yet, how would you define on which level it can occur or is it only on the current level (that would be a possibility)? In the sense of, would
hold if we have |
A few other edge cases we have to define:
|
And naming needs a decision, I saw that others use |
I guess something like using JsonPath to select a value/obj/array and make an assertion could be handy as well. No need to support that from the start though, if someone should need it "immediately" then let me know it. |
JsonPath just wouldn't conform with the DSL and is not an assertion language but rather a retreival language... if JsonArray is treated like a List and JsonObject like a map, then regular assertions could be made on its structure. This would be easier to maintain, as all it would need is initial parsing that I suppose most platforms already have in some form or other... what would jsonpath add to this? |
I would use JsonPath for retrieval, it could make assertions more readable in certain cases. Following an example:
This would collect all authors of books and one could make an assertion about them. Of course, one could also do the retrieval beforehand and then assert on the resulting list. This is one of the reasons why this is a low prio feature and I will not add it at the beginning. |
Platform (JVM and/or JS): JVM/JS
Code related feature
Yet to be defined how it should look like and how it should behave.
Following a suggestion:
Where it normally should not matter in which order the properties appear. However, I am not sure how we should treat data which we did not expect (
val
in the above example).Sometimes even order matters, for such cases we could introduce something like
inOrder
:Ideas and feedback are welcome.
The text was updated successfully, but these errors were encountered: