Skip to content
Snippets Groups Projects
Commit 6d326597 authored by Colton Leekley-Winslow's avatar Colton Leekley-Winslow Committed by GitHub
Browse files

Merge pull request #441 from scitran/schema-defs-additional-properties

Schema defs additional properties
parents 7977e0d1 27a34374
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ traits:
- validates-json-body:
description: Validates incoming request body
responses:
422:
400:
description: |
JSON did not validate against schema for this endpoint
......
......@@ -67,5 +67,6 @@
"_id": {
"type": "string"
}
}
},
"additionalProperties": false
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref":"user.json#",
"additionalProperties":{
"created":{"type":"string"},
"modified":{"type":"string"}
},
"required":[
"_id", "firstname", "lastname",
"root", "email", "created", "modified"
]
}
......@@ -38,5 +38,6 @@
"type": "object"
}
},
"type":"object"
"type":"object",
"additionalProperties": false
}
......@@ -2,6 +2,6 @@
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"$ref":"../definitions/user.json#"
"$ref":"../definitions/user-output.json#"
}
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref":"../definitions/user.json#"
"$ref":"../definitions/user-output.json#"
}
......@@ -19,11 +19,6 @@ hooks.skip("POST /upload/label -> 402");
hooks.skip("POST /upload/uid -> 402");
hooks.skip("POST /upload/uid-match -> 402");
// Should 422 for JSON not matching schema
// After this is fixed, add "validates-json-body" trait
// to all endpoints which validate a json body
hooks.skip("POST /users -> 422");
// Should 404
hooks.skip("GET /jobs/{JobId} -> 404");
......@@ -109,8 +104,8 @@ hooks.before("GET /download -> 404", function(test, done) {
done();
});
hooks.before("POST /users -> 422", function(test, done) {
test.request.body = {totally:"not valid"};
hooks.before("POST /users -> 400", function(test, done) {
test.request.body = {api_key:{key:"test"}};
done();
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment