-
Notifications
You must be signed in to change notification settings - Fork 11
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
Implement aggregation of error messages for different entries in maps #56
Implement aggregation of error messages for different entries in maps #56
Conversation
Pinging @cocuh for review :) |
Sorry for late reply, and thank you for PR! I took vacation for weeks, and I came back today. Let me review the PR tomorrow. 🐱 |
Thank you for your contribution! and sorry for taking time to review! 🐱 |
With the structure proposed in this PR - yes, definitely and that was the goal. Consider the proposal in #38:
This is exactly the shape that you refer to in your
Depends on how you look at it and the abstraction you are comfortable operating with. We established that grouping key-value comparison is a good idea and clarifies the output and the proposed structure achieves exactly that. There are more complicated cases of comparison (i.e
Not really, we would need grouping and something that would encapsulate a single diff in the map. Most likely this means creation of the struct outside of the
There are couple of problems with this approach:
If we would like to keep implementation more based to the cases we have at hand we could combine our ideas and start by creating a
And then we modify the
wdyt? I think that might be a good path forward and allows for simpler implementation of colorization for diffs. You would just have to work on |
@cocuh thanks for the initial review, what do you think about the proposed approach? |
Hmmm, this is difficult discussion.
I don't think this flexiblity produces readable output. Each fact generation logic should summarize results for readability as much as possible based on the knowledge of the structure. For example, comparison of nested map, if inputs are ...
and nested output can be..
but, I think next output is better, and extensible if having many diffs.
Structured fact may be useful when writing library code, but I think it will reuslt in damaging user experience because of allowing compricated error message to users. (and also it makes library more complicated) About your proposal, I don't think introducing type parameter to Fact structure is a good option, because we should put all object specigic logic under XXXAssertion. If we introduce the type variable to Fact, generating message in I agree on your points (1,2,3) on current design. About the first point, we should minimize the copy-paste though, scattering can be interpretted as customizable for each type. The first two items can be resolved by introducing util functions as intermediate layer; for example you introduced in I exlored options for colorization and noticed this is much more complicated than my expecatation. Let's ignore it in this issue. Thanks, 🐱 |
Thanks for the feedback @cocuh and sorry for the late update! I implemented the message consolidation according to your suggestion, PTAL. Apologies if I made the conversation difficult, that was not my intention. I wanted to propose the approach that I think is better which might be somewhat complicated for the current stage of the library development. Thanks for your patience and detailed opinion. |
Fact
.
Thank you for updating PR! LGTM for the change, and I appreciate your suggestion and discussion happened in this thread as it helped me to come up with better design on the colorization. |
This PR tries to extend
Fact
API to accommodate for requirements in #38. The implementation is somewhat rough on the edges but gets the main idea across as well as improves error messaging for maps.We can iterate on this PR and come up with the handling of the corner cases and/or simplification. The rendering of the AST is not generic but is reasonable for now. We can definitely discuss this more in detail in this PR.