Parameters accept a value option for fixed values. #369
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
When building out a JSONAPI, every endpoint has a
typefield with a fixed value of the resources name. Writingparameter :type, 'The object type', value: 'users'is more clear of it's static nature than looking for alet.More broadly, when using
rspec_api_documentationfor 10-15 projects now. Havingletreserved for dynamic values and usingvalue: 3for things that are static, seems to reduce the "noise" in writing larger spec files.Need Feedback
Not 100% sure on the
value:naming convention. I also tried havingmethodsupport a block (likemethod: -> { '3' }), but that did not feel right.Notes
Gemfile.lock. I suggest removing theGemfile.lockfrom the repo (gitignoreit) and depend on thegemspec.jsongem in order to run bundle on Ruby 2.5 / OSX 10.13