-
Notifications
You must be signed in to change notification settings - Fork 4
/
schemas.js
43 lines (40 loc) · 1.28 KB
/
schemas.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* Define the json in order to validate the administration requests
*/
var Joi = require('joi');
var schemas = {};
schemas.resource = Joi.object().keys({
offering: Joi.object().keys({
organization: Joi.string().min(1).required(),
name: Joi.string().min(1).required(),
version: Joi.string().min(1).required()
}),
provider: Joi.string().min(1).required(),
name: Joi.string().min(1).required(),
version: Joi.string().min(1).required(),
content_type: Joi.string().min(1).required(),
url: Joi.string().min(1).required(),
record_type: Joi.string().min(1).required(),
unit: Joi.string().min(1).required(),
component_label: Joi.string().min(1).required()
});
schemas.offer = {
offering: Joi.object().keys({
organization: Joi.string().min(1).required(),
name: Joi.string().min(1).required(),
version: Joi.string().min(1).required()
}),
reference: Joi.string().min(1).required(),
customer: Joi.string().min(1).required(),
customer_name: Joi.string().min(1).required(),
resources: Joi.array().required().items(
Joi.object().keys({
provider: Joi.string().min(1).required(),
name: Joi.string().min(1).required(),
version: Joi.string().min(1).required(),
content_type: Joi.string().min(1).required(),
url: Joi.string().min(1).required()
})
)
}
module.exports = schemas;