-
Notifications
You must be signed in to change notification settings - Fork 45
feat(error-check): add check for error message #198
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
Conversation
34475ff to
e18a9bb
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.
Feel free to take or leave my suggestions/questions; none are of high importance to me. I'd definitely wait for @Nezteb 's review.
e18a9bb to
354811a
Compare
| 'items' in schemaNode.fragment && | ||
| schemaNode.primaryType === SchemaNodeKind.Array && | ||
| schemaNode.fragment.items !== null && | ||
| 'x-sl-error-message' in (schemaNode.fragment.items as any) |
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.
is there away to avoid the .items as any twice in this block?
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.
Thanks Daniel for working with me on the type checking to ensure we didn't need to cast it as any!
354811a to
cc3d821
Compare
| const items: unknown = fragment['items']; | ||
| if (typeof items === 'object' && items !== null) { | ||
| const itemsErrorMessage = items['x-sl-error-message']; | ||
| if (typeof itemsErrorMessage === 'string') { |
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 like what y'all did here. It makes me like TypeScript even more. 🙂
35f9503 to
9d52065
Compare
9d52065 to
e2de87d
Compare
e2de87d to
9e28d99
Compare
|
🎉 This PR is included in version 4.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Motivation and Context
When users are viewing public endpoints that reference internally marked schemas, we need a way to display an error message to let the user know they do not have permissions to view it.
#InsertIssueNumberHere
https://github.com/stoplightio/platform-internal/issues/10534
Description
Added a check at the toplevelschemarow and at the schemarow levels to check for the
x-sl-error-messagepropertyHow Has This Been Tested?
Manually tested changes by pulling this package into platform internal and manually making changes to the schema and schema permissions and seeing if the error message showed up as expected.
Added test coverage for SchemaRow
Screenshot(s)/recordings(s)
Types of changes
Checklist