-
Notifications
You must be signed in to change notification settings - Fork 30
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
feat: use @stoplight/json-schema-tree #91
Conversation
463e33f
to
4cafc50
Compare
cbb0514
to
7d40348
Compare
@marbemac feel free to take a look at the changelog to see if there isn't anything you would like me to revert. |
All tests are passing now. |
b54ea93
to
7e13e2c
Compare
an additional question - shall we make json-schema-tree repo public? |
Yeah that's fine. When we're ready to merge all of this we should also release 1.0 of json-schema-tree so that it's not in forever beta hell :).
What do you mean by eagerly? All the way down or only refs that are present at the depth that is expanded already? e.g. if really deep schema, and everything is collapsed to start, will deep $refs be eagerly resolved or only resolved on demand as user expands the tree? Also are local $ref pointers managed out of the box? |
Only $refs refs that are present at the depth that is expanded already. Current 3.0 had a possibility to avoid upfront dereferencing entirely and do it when user expands the ref.
Yup, they are. |
I'll try to extract a few changes to separate PRs to make reviewing more feasible. |
0230299
to
4cc5854
Compare
"@stoplight/react-error-boundary": "^1.0.0", | ||
"@stoplight/tree-list": "^5.0.3", | ||
"classnames": "^2.2.6", | ||
"lodash": "^4.17.15" |
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.
What, no lodash? I can't believe that, how do you even write code? 😇
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.
IIRC lodash was used in 2-3 spots in JSV. In fact, the only useful fn was pick
, but I got rid of it in JST completely.
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.
I was just kidding 😄 It's nice that you got rid of it. It's still a transient dep - and likely will be for the foreseeable future - but less direct dependencies are always nice.
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.
Yeah, I'm not a fan of bringing the whole library if you only use it once or twice. 😆
It's totally okay if you actually use it, but makes little to no sense if you only use pick
in a single spot.
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.
True, especially because it doesn't tree shake as well & as easily as it should. At least it didn't about a year ago, as it's mainly CJS
4cc5854
to
bdc4225
Compare
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.
The truth is, this PR changes too much code for to effectively review. I'm gonna allow it because I don't see any other choice, but I think in the future, we should try to plan this kind of thing better.
It's good changes though. 👍🏻
Basically, my attitude is: we'll play around with it and try to break it when you make the PR to platform-internal
. But you say it works good when yalced so 🤷🏻♂️ I believe ya.
bdc4225
to
b182faa
Compare
Frankly, this PR is smaller than it may seem.
|
🎉 This PR is included in version 4.0.0-beta.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
BREAKING CHANGE: shouldResolveEagerly prop has been removed
I'd still argue that a +710-1383 PR is effectively impossible to review thoroughly, but I'm glad it's in 😄 |
Release failed unfortunately :\ |
Complementary PRs: #96 #97 #98 #95 #100
There is one major breaking change from component's perspective - $refs are resolved eagerly by default and there is no way to alter this behavior.
We had that option enabled at all times in all projects anyway, thus it only added redundant complexity for us.
That said, a few tests had to be updated to account for that change.
There was a number of tests updated as a result of better handling of a particular scenario.
$refs
Before and after
3.0
![image](https://user-images.githubusercontent.com/9273484/102421458-bd01f100-4004-11eb-9343-f57921ce6470.png)
This PR
![image](https://user-images.githubusercontent.com/9273484/102421250-4a911100-4004-11eb-9be3-fc14de38119e.png)
3.0
![image](https://user-images.githubusercontent.com/9273484/102421473-c68b5900-4004-11eb-8c3d-9ffaa039fb79.png)
This PR
![image](https://user-images.githubusercontent.com/9273484/102421288-672d4900-4004-11eb-9111-52631131bff8.png)
3.0*
![image](https://user-images.githubusercontent.com/9273484/102426663-086dcc80-4010-11eb-836a-d8e77fd8a5d7.png)
This PR
![image](https://user-images.githubusercontent.com/9273484/102426516-c8a6e500-400f-11eb-8d72-1274cc5e22f7.png)
3.0
![image](https://user-images.githubusercontent.com/9273484/102427259-461f2500-4011-11eb-8636-2061b567c63e.png)
This PR
![image](https://user-images.githubusercontent.com/9273484/102427353-723aa600-4011-11eb-9192-b85b5e250e30.png)
The array flattening logic adds a tiny bit of complexity, but I decided to implement it so that we can leverage this updated component in existing products. I'm aware that it's likely to be thrown away in the next iteration of JSV, but until then, we couldn't benefit from the improvements.
I decided to tweak the naming as well - hopefully I did a good job here 😆
Changelog
Full list of notable differences vs existing 3.0 (certain pieces were extracted to separate PRs, but listing them here to keep track of them):
{ format: 'date-time' }
{ "type": "array", "items": [item1, item2, ...] }
)