Skip to content

Commit 55902d2

Browse files
committed
starting basic schema template
1 parent be46173 commit 55902d2

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

schema/policy.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@
88

99

1010
def policy_schema(common_definitions):
11-
print("Generating policy schema")
11+
"""
12+
Create the schema for the Policy endpoint.
13+
"""
14+
# load schema template and insert definitions
15+
schema = common.load_json("./templates/policy/policy.json")
16+
schema["definitions"] = {
17+
"version": common_definitions["version"]
18+
}
19+
20+
# verify and return
21+
return common.check_schema(schema)
1222

1323

1424
def schema_generators():

schema/templates/policy/policy.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,38 @@
55
"type": "object",
66
"definitions": {},
77
"required": [
8+
"data",
9+
"version"
810
],
911
"properties": {
12+
"data": {
13+
"$id": "#/properties/data",
14+
"type": "object",
15+
"description": "The data records in this payload",
16+
"required": [
17+
"policy"
18+
],
19+
"properties": {
20+
"policy": {
21+
"$id": "#/properties/data/properties/policy",
22+
"type": "array",
23+
"title": "The policy payload",
24+
"items": {
25+
"$id": "#/properties/data/properties/policy/items",
26+
"type": "object",
27+
"title": "The policy item schema",
28+
"additionalItems": false,
29+
"required": [],
30+
"properties": {}
31+
}
32+
}
33+
},
34+
"additionalProperties": false
35+
},
36+
"version": {
37+
"$id": "#/properties/version",
38+
"$ref": "#/definitions/version"
39+
}
1040
},
1141
"additionalProperties": false
1242
}

0 commit comments

Comments
 (0)