-
Notifications
You must be signed in to change notification settings - Fork 90
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: Validate missing response description #186
Conversation
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.
This is a good addition, thanks for the PR. Just two small changes to make
`A ${statusCode} response should include a description.`, | ||
'error' | ||
); | ||
} |
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.
This looks good. I actually think we should move this check up to line 55 since this is required of all responses, not just success responses.
b9f5fb5
to
bb500d6
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.
Sorry to be a little picky, but requesting one more round of changes and then will approve
@@ -52,6 +52,13 @@ module.exports.validate = function({ resolvedSpec }, config) { | |||
} else { | |||
// default warnings for discouraged status code per IBM API Handbook |
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.
Okay I have to be a little obnoxious here but for the sake of clarity, this comment should be moved to be just before if (statusCode === '422') {
. Those are the checks the comment describes, so it is a little confusing to leave here as if it applies to everything.
if (!obj[statusCode].description) { | ||
messages.addMessage( | ||
path.concat([statusCode]), | ||
`A ${statusCode} response should include a description.`, |
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 didn't look at this close enough last time - because this check is an unconditional requirement and applies to every response, this message is slightly misleading. I think it should be changed to
`A ${statusCode} response should include a description.`, | |
'All responses must include a description.', |
bb500d6
to
dda9a63
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.
Looks good! Thanks 👍
# [0.29.0](v0.28.1...v0.29.0) (2020-08-11) ### Features * Validate missing response descriptions ([#186](#186)) ([751c18d](751c18d))
🎉 This PR is included in version 0.29.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Throw error when a description is missing for any response schema since failing to do so will cause a compilier error.