-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix: handle invalid schema data #106
Conversation
lottamus
commented
Jul 11, 2020
- fixes https://github.com/stoplightio/platform-internal/issues/3501
🎉 This PR is included in version 3.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Hmm, I saw this merged but I got a review request so just posting this for the posterity.
This is very wrong to me. The Schema
type is already implying that data
is an object and not undefined.
If this line is required it means somebody calling this function is lying/casting. That's not this function's problem; it should not be the its job of this function to validate the passed value; otherwise why do we have the types for?
You can see this effectively by the fact that you had to "lie" in the test by doing a ts-ignore.
I'd vote to fix this where the real problem is and not here @lottamus @marbemac
@XVincentX yeah since we are transforming user input, we cannot assume the
|
I would not rely on this for the following reasons:
I wouldn't want to throw an exception either, but we could use the That said — I understand now the issue and I've created a ticket to tame this although to be honest, I do not think we're going to have the time to make this right, but you never know. |
True, but
The reasoning I was trying to make was that it's not
Exactly, thus |
Completely agree with this. That's way I was pointing out that Spectral is not enough. I must have misunderstood your comment.
I agree with this also, but if so this specific is going on a different direction, right? ( Seems like we're on the same page. |