In case you don't have Node.js installed locally use NVM:
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash $ nvm install v0.12.2 $ nvm use v0.12.2 $ nvm alias default v0.12.2
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
# API Name | |
## Message Resource [/resource] | |
### Create a Message [POST] | |
+ Request | |
+ Attributes (Message) | |
+ Response 200 | |
+ Attributes | |
+ id (string) |
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
var hooks = require('hooks'); | |
// Recursively add null as acceptable type if there is string | |
// "#nullable" present in the property description | |
var patchPropertiesWithNullable = function(schema) { | |
if (typeof(schema['properties']) == 'object' && ! Array.isArray(schema['properties'])){ | |
for (property in schema['properties']){ | |
var partialSchemaToPatch = schema['properties'][property]; | |
schema['properties'][property] = patchPropertiesWithNullable(partialSchemaToPatch); | |
}; |
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
# My API | |
# My Resource [/my_resource] | |
# Its Action [GET] | |
+ Response 200 (application/json) | |
+ Attributes (My Structure) |
{
"name": "23AndMe",
"desc": "23andMe is a personal genetics service. 23andMe offers individual genome and DNA testing and information. The 23andMe API allows developers to access and integrate the data from 23andMe with other applications and to create new applications. Individuals consent to giving third-party access to the 23andMe data. Some example API methods include accessing user information, retrieving profiles, and getting information on genotypes",
"url": "https://api.23andme.com",
"oauth2": {
"authorize": "/authorize",
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
FORMAT: 1A | |
HOST: https://cryptic-badlands-8184.herokuapp.com/ | |
# Life saving API | |
# Emergency [/912] | |
# Request first aid [POST] | |
+ Request (application/json) |
- Failing Dredd transactions programatically in hooks
- Dredd hooks chai integration
- Headers values are tested only for content-negotiation headers
- Dredd documentation & tutorials kickoff
- Writing Dredd hooks in Ruby
- "Cloud Dredd" production API testing - proof of concept
- Libpcap based HTTP interceptor (a.k.a SHAIN)
kolotoc:dredd-rack-sinatra-example netmilk$ bundle exec rake blueprint:verify
Verify the API conformance against its blueprint.
dredd doc/*.apib doc/*.apib.md --hookfiles doc/hooks/hooks-worker-client.coffee
info: Beginning Dredd testing...
info: Found Hookfiles: doc/hooks/hooks-worker-client.coffee
Spawning ruby worker
Dredd Ruby hooks worker is running
FORMAT: 1A
API Exmample for demonstration of different versions of JSON schema
- Request (application/json)