cybertk / abao

REST API automated testing tool based on RAML
MIT License
354 stars 59 forks source link

Features desired #2

Open cybertk opened 10 years ago

cybertk commented 10 years ago
cybertk commented 10 years ago

Abao should support body of application/json only

ddossot commented 9 years ago

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 commented 9 years ago

@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 commented 9 years ago

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 https://github.com/cybertk/abao/issues/2#issuecomment-64064652.

cybertk commented 9 years ago

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 commented 9 years ago

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 https://github.com/cybertk/abao/issues/2#issuecomment-64070243.

cybertk commented 9 years ago

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 commented 9 years ago

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 https://github.com/cybertk/abao/issues/2#issuecomment-64071561.

cybertk commented 9 years ago

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

sielay commented 9 years ago

@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 commented 9 years ago

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

sielay commented 9 years ago

@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 commented 9 years ago

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

cybertk commented 9 years ago

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

seebi commented 9 years ago

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 commented 9 years ago

@seebi Yes, you are absolute right.

ddossot commented 9 years ago

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

sprakasam commented 8 years ago

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