Skip to content

Commit 0a8be31

Browse files
committed
fix: allow subsets to warn (but not fail) when a fieldset is referenced but not loaded
1 parent fe04b23 commit 0a8be31

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/schema/subset_filter.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,15 @@ def extract_matching_fields(
179179
subset_definitions: Dict[str, Any]
180180
) -> Dict[str, FieldEntry]:
181181
"""Removes fields that are not in the subset definition. Returns a copy without modifying the input fields dict."""
182-
retained_fields: Dict[str, FieldEntry] = {x: fields[x].copy() for x in subset_definitions}
182+
retained_fields: Dict[str, FieldEntry] = {}
183+
for x in subset_definitions:
184+
if x not in fields:
185+
print('{0} included in subset but has not been loaded'.format(x))
186+
else:
187+
retained_fields[x] = fields[x].copy()
183188
for key, val in subset_definitions.items():
189+
if key not in fields:
190+
continue
184191
retained_fields[key]['field_details'] = fields[key]['field_details'].copy()
185192
for option in val:
186193
if option != 'fields':

0 commit comments

Comments
 (0)