apiaryio / dredd

Language-agnostic HTTP API Testing Tool
https://dredd.org
MIT License
4.2k stars 280 forks source link

JSON-diff fails if body includes null-values #77

Closed manuel84 closed 10 years ago

manuel84 commented 10 years ago

body: The ... property is required.

(no schema specified)

netmilk commented 10 years ago

Hi, thank you very much for the report, can you provide an example body, which you are trying to test?

manuel84 commented 10 years ago

I get this failure since v 0.3.3. Now I'm working with Version 0.3.2, which accepts null values.

info: Displaying failed tests... fail: GET /api/status.json duration: 5705ms fail: body: The ‘build’ property is required. body: The ‘revision’ property is required. body: The ‘message’ property is required.

request: body:

headers: User-Agent: *\ Test/0.9.9 (iPhone; iOS 7.0.4; Scale/2.00)

uri: /api/status.json method: GET

expected: headers: content-type: application/json; charset=utf-8

body: { "version": 2, "build": null, "revision": null, "locales": [ "de", "en" ], "deploy": "2014-06-17T11:36:02+02:00", "boot": "2014-07-01T09:49:09+02:00", "message": null }

statusCode: 200

actual: statusCode: 200 headers: access-control-allow-origin: * access-control-allow-methods: POST, GET, OPTIONS access-control-max-age: 1728000 content-type: application/json; charset=utf-8 x-ua-compatible: IE=Edge,chrome=1 etag: "d96b14b424d1d39e16aaad2ac2a97529" cache-control: max-age=0, private, must-revalidate x-request-id: f724995a543d54bb6e6dffb8bf8f3d77 x-runtime: 0.000000 server: WEBrick/1.3.1 (Ruby/2.1.2/2014-05-06) date: Tue, 01 Jul 2014 09:51:37 GMT content-length: 151 connection: Keep-Alive set-cookie: _session_id=BAh7BkkiD3Nlc3Npb25faWQGOgZFVEkiJTc1ZGVmOTZhMDZiZWFmODkwNjllZmNiMzYzYmI2YmZiBjsAVA%3D%3D--0fa9cee0c816e76742a03335b0477066246e80b7; path=/; HttpOnly,_session_id=BAh7BkkiD3Nlc3Npb25faWQGOgZFVEkiJTc1ZGVmOTZhMDZiZWFmODkwNjllZmNiMzYzYmI2YmZiBjsAVA%3D%3D--0fa9cee0c816e76742a03335b0477066246e80b7; path=/; HttpOnly,_paij_backend_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFVEkiJTc1ZGVmOTZhMDZiZWFmODkwNjllZmNiMzYzYmI2YmZiBjsAVA%3D%3D--0fa9cee0c816e76742a03335b0477066246e80b7; path=/; HttpOnly

body: {"version":2,"build":null,"revision":null,"locales":["de","en"],"deploy":"2014-06-17T11:36:02+02:00","boot":"2014-07-01T09:49:09+02:00","message":null}

netmilk commented 10 years ago

Thanks for the mention about version change. It seems to be related to Amanda validator update in Gavel.

netmilk commented 10 years ago

Fixed in freshly released Dredd v0.3.7. Regression tests added, so it should not appear any more.