Prevent the need for repetition in sample definitions#2
Merged
Conversation
Member
Author
|
@nwhite89 this change somehow modifies the semantics of an ABE file, as it defines the meaning when a request section is missing. This made me realise that in ABE-spec, we need to document better what all fields mean, what is optional and mandatory, etc. Also, this PR may imply a change in the format version and as such we need to update the JS packages that use the format. Let me know what you think. Maybe we want to start with a PR to the spec? |
txels
added a commit
that referenced
this pull request
Sep 17, 2015
Prevent the need for repetition in sample definitions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Allow one to skip repeating the request URL in all samples, which is the case when the URL of the endpoint under tests is fixed (contains no variable parts).
E.g. this is an example from a project I'm working on:
{ "description": "Retrieve profile of logged in user", "url": "/accounts/me", "method": "GET", "examples": { "OK": { "response": { "status": 200, "body": { "id": 1, "username": "user-0", "first_name": "", "last_name": "", "email": "user-0@example.com" } } }, "unauthenticated": { "description": "I am not logged in", "response": { "status": 403, "body": { "detail": "Authentication credentials were not provided." } } } } }Before this PR, I had to write:
{ "description": "Retrieve profile of logged in user", "url": "/accounts/me", "method": "GET", "examples": { "OK": { "request": { "url": "/accounts/me" }, "response": { "status": 200, "body": { "id": 1, "username": "user-0", "first_name": "", "last_name": "", "email": "user-0@example.com" } } }, "unauthenticated": { "description": "I am not logged in", "request": { "url": "/accounts/me" }, "response": { "status": 403, "body": { "detail": "Authentication credentials were not provided." } } } } }...which includes some tedious repetition.