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

Features desired #2

Open
2 of 9 tasks
cybertk opened this issue Oct 16, 2014 · 18 comments
Open
2 of 9 tasks

Features desired #2

cybertk opened this issue Oct 16, 2014 · 18 comments

Comments

@cybertk
Copy link
Owner

cybertk commented Oct 16, 2014

  • test.request.body should be object when Content-Type is application/json
  • Should not display pending test if invoke abao with --hook-only
  • Should give a warning if Content-Type is not application/json
  • Should give a warning if hook is ignored
  • Let hook's done param optional
  • Validate fail if an array field contains no elements
  • gulp-abao
  • grunt-abao
  • abao-example
@cybertk
Copy link
Owner Author

cybertk commented Oct 21, 2014

Abao should support body of application/json only

@ddossot
Copy link

ddossot commented Nov 22, 2014

Be careful with limiting to application/json only as it will prevent people to use media types to version their APIs.

In this case, RAML files will typically have a root section entry like this:

mediaType: application/vnd.acme.api.v1+json

@cybertk
Copy link
Owner Author

cybertk commented Nov 22, 2014

@ddossot I haven't hear about using media types to version APIs before, after a short google, I found it's related to Grape. Is this type of versioning widely used?

@ddossot
Copy link

ddossot commented Nov 22, 2014

Yes, it's widely used in hypermedia-enabled REST APIs. RAML supports it out
of the box so please do not put an arbitrary limitation on this feature.

And it's not Grape-specific in any way.
On 2014-11-21 6:15 PM, "Quanlong" notifications@github.com wrote:

@ddossot https://github.com/ddossot I haven't hear about using media
types to version APIs before, after a short google, I found it's related to
Grape. Is this type of versioning widely used?


Reply to this email directly or view it on GitHub
#2 (comment).

@cybertk
Copy link
Owner Author

cybertk commented Nov 22, 2014

So, if there are various media-type returns json, how does Abao cover all these media-types. As Abao is supposed to support json validation only at this moment.

@ddossot
Copy link

ddossot commented Nov 22, 2014

All these media types are sub-types of application/json so they can be
validated with a standard JSON Schema validator.

So basically, to reuse my previous example, there should be nothing
particular to do to validate a application/vnd.acme.api.v1+json request
or response body besides recognizing that it's a subtype of
application/json, and thus use standard JSON validation.

PS. Thank you so much for Abao.
On 2014-11-21 9:42 PM, "Quanlong" notifications@github.com wrote:

So, if there are various media-type returns json, how does Abao cover
all these media-types. As Abao is supposed to support json validation
only at this moment.


Reply to this email directly or view it on GitHub
#2 (comment).

@cybertk
Copy link
Owner Author

cybertk commented Nov 22, 2014

Thank you for your explain.

So in the implementation, it should be

if mediaType == 'application/json' or mediaType == 'application/vnd.acme.api.v1+json or <all other subtypes>

or

 if mediaType == 'application/*json'

@ddossot
Copy link

ddossot commented Nov 22, 2014

The latter would be perfect!
On 2014-11-21 10:50 PM, "Quanlong" notifications@github.com wrote:

Thank you for your explain.

So in the implementation, it should be

if mediaType == 'application/json' or mediaType == 'application/vnd.acme.api.v1+json or

or

if mediaType == 'application/*json'


Reply to this email directly or view it on GitHub
#2 (comment).

@cybertk
Copy link
Owner Author

cybertk commented May 28, 2015

Let hook's done param optional is related to #35

@sielay
Copy link

sielay commented Jun 21, 2015

@cybertk not sure if understand that list, but is that a reason that when I send something with request.body that isn't sent as a form; and when I set Content-Type to 'multipart/form-data' throws exception that it doesn't have a body?

@cybertk
Copy link
Owner Author

cybertk commented Jun 21, 2015

@sielay abao can only send body as application/json at this moment.

@sielay
Copy link

sielay commented Jun 21, 2015

@cybertk I worked it around, but to satisfy all REST/RAML consumers it's worth to support forms. Basic APIs always will prefer that way, as it's built in majority of frameworks. But personally I can wait ;)

@seebi
Copy link

seebi commented Sep 21, 2015

another argument is e.g. application/sparql-results+json as in the SPARQL 1.1 Query Results JSON Format W3C Recommendation

@cybertk
Copy link
Owner Author

cybertk commented Sep 21, 2015

Thanks @seebi, so we will use regex application/(*.\+)?json for supported json payload?

@seebi
Copy link

seebi commented Sep 22, 2015

I am not sure if the + is more then a convention but we can start with that.

But imho you should use application/(.*\+)?json instead ...

@cybertk
Copy link
Owner Author

cybertk commented Sep 22, 2015

@seebi Yes, you are absolute right.

@ddossot
Copy link

ddossot commented Sep 22, 2015

@seebi The + (and . for that matter) is per spec: http://tools.ietf.org/html/rfc6838#section-4.2

@sprakasam
Copy link

does anyone know how to pass data to test.request.body if content-type is 'application/x-www-form-urlencoded'?

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

No branches or pull requests

6 participants