Skip to content

Commit 8cb1ba8

Browse files
committed
find schemas in different directories
1 parent 9257269 commit 8cb1ba8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

stix2validator/validator.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,8 @@ def find_schema(schema_dir, name):
635635
"""Search the `schema_dir` directory for a schema called `name`.json.
636636
Return the file path of the first match it finds.
637637
"""
638-
if name in _SCHEMAS_FOUND:
639-
return _SCHEMAS_FOUND[name]
638+
if schema_dir in _SCHEMAS_FOUND and name in _SCHEMAS_FOUND[schema_dir]:
639+
return _SCHEMAS_FOUND[schema_dir][name]
640640

641641
schema_filename = name + '.json'
642642

@@ -645,7 +645,9 @@ def find_schema(schema_dir, name):
645645
continue
646646
if schema_filename in filenames:
647647
schema_path = os.path.join(root, schema_filename)
648-
_SCHEMAS_FOUND[name] = schema_path
648+
if schema_dir not in _SCHEMAS_FOUND:
649+
_SCHEMAS_FOUND[schema_dir] = dict()
650+
_SCHEMAS_FOUND[schema_dir][name] = schema_path
649651
return schema_path
650652

651653

0 commit comments

Comments
 (0)