feat: format object properties with types - #59
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #59 +/- ##
==========================================
- Coverage 98.72% 98.13% -0.59%
==========================================
Files 5 5
Lines 550 645 +95
Branches 250 268 +18
==========================================
+ Hits 543 633 +90
- Misses 7 12 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
alexander-akait
left a comment
There was a problem hiding this comment.
Let's add test for multiple types, output should be like <key>: string | integer.
For objects we don't expand them, right?
|
Yes objects and arrays are not expanded |
|
Multiple types could be only with |
|
so @evilebottnawi what we need in this PR still? Tests on |
|
@vankop all is good, i will review deeply this in near future |
|
/cc @vankop need rebase, also i think we should improve output using |
@evilebottnawi you have any ideas how to do it better? When I did this I was thinking about it, but did not realized how to do it better, since it depends totally on terminal window size + font type/size. Approach when we rely only on amount of properties also fails because of glyph sizes |
|
@vankop the good question, maybe we can solve this in other PR, i think packages like |
# Conflicts: # src/ValidationError.js # test/__snapshots__/index.test.js.snap
… into more-info-for-object-properties
|
/cc @evilebottnawi Ready to review
I think this really important, I will take a look in |
|
Also interesting question is - do we need sort properties alphabetically? |
|
@vankop it is very old 😄 what we will do with it? close or rebase? 😄 |
|
I could merge main to make this relevant again |
|
@vankop Yeah, let's do it |
|
Thank you for this @vankop, and sorry it sat for so long. The feature landed in #224, which took the same approach you proposed here — the type next to the property name, arrays and objects skipped, exactly as you described in this thread. It formats the type through The two questions you raised here are still open and are not answered by that PR: breaking a long object over several lines (also in #42 (comment)), and whether to sort properties alphabetically. Worth their own issue rather than keeping this one open on top of a 2019 base. Closing as superseded — the idea was yours, and #225 credits you for the part of #68 it carries over. Generated by Claude Code |
This PR contains a:
Motivation / Use-Case
#42
2nd proposal
Breaking Changes
no
Additional Info
Looks like for array and object we can skip formatting type.