Skip to content

Commit 1ca3cff

Browse files
committed
JSON checking no longer using PLIST_TYPES
1 parent 81a68c9 commit 1ca3cff

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

pre_commit_hooks/check_jamf_json_manifests.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
from pre_commit_hooks.util import PLIST_TYPES, validate_required_keys
1313

1414
# Types found in the Jamf JSON manifests
15-
MANIFEST_TYPES = (
16-
"array",
17-
"boolean",
18-
"data",
19-
"date",
20-
"float",
21-
"integer",
22-
"number",
23-
"object",
24-
"real",
25-
"string",
26-
)
15+
MANIFEST_TYPES = {
16+
"array": list,
17+
"boolean": bool,
18+
"data": str,
19+
"date": datetime,
20+
"float": float,
21+
"integer": int,
22+
"number": int,
23+
"object": dict,
24+
"real": float,
25+
"string": str
26+
}
2727

2828
# List keys and their expected item types
2929
MANIFEST_LIST_TYPES = {
@@ -132,9 +132,9 @@ def validate_default(name, prop, type_found, filename):
132132
actual_type = str
133133
else:
134134
actual_type = type(prop[test_key])
135-
if actual_type != PLIST_TYPES.get(type_found):
135+
if actual_type != MANIFEST_TYPES.get(type_found):
136136
print(
137-
f"{filename}: {test_key} value for {name} should be {PLIST_TYPES.get(type_found)}, not {type(prop[test_key])}"
137+
f"{filename}: {test_key} value for {name} should be {MANIFEST_TYPES.get(type_found)}, not {type(prop[test_key])}"
138138
)
139139
passed = False
140140

0 commit comments

Comments
 (0)