Skip to content

Commit 292bbd5

Browse files
authored
Merge pull request #364 from Esri/Caleb/Update-AddMetadataCategoryChecking
[Update] Add metadata category checking
2 parents 9e041ab + ca0b8e0 commit 292bbd5

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

Scripts/CI/common.py

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,19 @@
3333
'Web Mercator'
3434
}
3535

36-
# A set of category folder names for legacy support.
36+
# A set of category folder names.
3737
categories = {
38-
'Maps',
39-
'Layers',
40-
'Features',
41-
'Display information',
42-
'Search',
43-
'Edit data',
44-
'Geometry',
45-
'Route and directions',
4638
'Analysis',
47-
'Cloud and portal',
39+
'Augmented Reality',
40+
'Cloud and Portal',
41+
'Edit and Manage Data',
42+
'Layers',
43+
'Maps',
4844
'Scenes',
49-
'Utility network',
50-
'Augmented reality'
45+
'Routing and Logistics',
46+
'Search and Query',
47+
'Utility Networks',
48+
'Visualization'
5149
}
5250
# endregion
5351

@@ -379,6 +377,19 @@ def flush_to_json_string(self) -> str:
379377

380378
return json.dumps(data, indent=4, sort_keys=True)
381379

380+
def check_category(self) -> None:
381+
"""
382+
Check if
383+
1. metadata contains a category.
384+
2. category is valid.
385+
386+
:return: None. Throws if exception occurs.
387+
"""
388+
if not self.category:
389+
raise Exception(f'Error category - Missing category.')
390+
elif self.category not in categories:
391+
raise Exception(f'Error category - Invalid category - "{self.category}".')
392+
382393

383394
class Readme:
384395
essential_headers = {

Scripts/CI/metadata_checker.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ def run_check(path: str) -> None:
7878
diff = '\n'.join(unified_diff(expected, actual))
7979
raise Exception(f'Error inconsistent metadata - {path} - {diff}')
8080

81+
# 4. Check category.
82+
try:
83+
checker.check_category()
84+
except Exception as err:
85+
raise Exception(f'{checker.folder_path} - {err}')
86+
8187

8288
def all_samples(path: str):
8389
"""

0 commit comments

Comments
 (0)