Skip to content
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: add warning, non-204 success response should have response body #127

Merged
merged 1 commit into from
Feb 7, 2020

Conversation

barrett-schonefeld
Copy link
Contributor

Related Issue: arf/planning-sdk-squad/issues/560

Changes:

  • added logic to check for response bodies in non-204 success responses in the oas3 plugin
  • added a test to check that a non-204 success response without response body generates a warning
  • added a test to check that multiple non-204 success responses without response bodies generates multiple warnings
  • updated the README.md to help users resolve potential issue with npm run link
  • fixed API definitions and tests that define a non-204 success without adding a response body

@claassistantio
Copy link

claassistantio commented Feb 3, 2020

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Feb 3, 2020

Codecov Report

Merging #127 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #127      +/-   ##
==========================================
+ Coverage   92.65%   92.66%   +0.01%     
==========================================
  Files          56       56              
  Lines        2055     2060       +5     
==========================================
+ Hits         1904     1909       +5     
  Misses        151      151
Impacted Files Coverage Δ
src/.defaultsForValidator.js 100% <ø> (ø) ⬆️
...s/validation/oas3/semantic-validators/responses.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4afde02...3a4e785. Read the comment docs.

Copy link
Member

@dpopp07 dpopp07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good! I just have a few comments to address before merging

README.md Outdated Show resolved Hide resolved
test/plugins/validation/oas3/responses.js Show resolved Hide resolved
test/plugins/validation/oas3/responses.js Show resolved Hide resolved
Copy link
Member

@dpopp07 dpopp07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. I forgot one thing in my last review - I don't believe this rule is explicitly required by the OpenAPI Spec. Since that's the case, the rule should be documented and configurable. You will need to:

  • Update the rules section of the readme
  • Update the rule defaults section of the readme
  • Update the defaults file
  • Check for configuration when it's time to check for the rule

Copy link
Member

@dpopp07 dpopp07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last change!

README.md Outdated Show resolved Hide resolved
- added logic to check for response bodies in non-204 success responses in the oas3 plugin
- added a test to check that a non-204 success response without response body generates a warning
- added a test to check that multiple non-204 success responses without response bodies generates multiple warnings
- updated the README.md to help users resolve potential issue with `npm run link`
- fixed API definitions and tests that define a non-204 success without adding a response body
- ran `npm run fix` to fix styling issues
- updated variable names to be more clear
- added to tests to compare expected messages and paths
- added no_response_body rule and set the default value to 'warning'
Copy link
Member

@dpopp07 dpopp07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

@dpopp07 dpopp07 merged commit 90689c8 into master Feb 7, 2020
@dpopp07 dpopp07 deleted the issue-560 branch February 7, 2020 18:36
dpopp07 pushed a commit that referenced this pull request Feb 7, 2020
# [0.18.0](v0.17.1...v0.18.0) (2020-02-07)

### Features

* add warning, non-204 success response should have response body ([#127](#127)) ([90689c8](90689c8))
@dpopp07
Copy link
Member

dpopp07 commented Feb 7, 2020

🎉 This PR is included in version 0.18.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants