Skip to content

Commit 2ab4a8c

Browse files
committed
feat(tool): fix failing tests
1 parent fe9449a commit 2ab4a8c

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

cve_bin_tool/vex_manager/validate.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -192,31 +192,32 @@ def validate_file(
192192
)
193193
else:
194194
# Use traditional jsonschema validation for CSAF and OpenVEX
195-
try:
196-
schema = self._get_schema(vex_type, version)
197-
if (
198-
schema and len(schema) > 0
199-
): # Only validate if schema was successfully loaded and not empty
195+
schema = self._get_schema(vex_type, version)
196+
if (
197+
schema and len(schema) > 0
198+
): # Only validate if schema was successfully loaded and not empty
199+
try:
200200
jsonschema.validate(instance=raw_data, schema=schema)
201201
self.logger.info(f"VEX file passed {vex_type} schema validation")
202-
except JsonSchemaValidationError as e:
203-
# Convert jsonschema validation error to our format
204-
path = ".".join(str(p) for p in e.path) if e.path else None
202+
except JsonSchemaValidationError as e:
203+
# Convert jsonschema validation error to our format
204+
path = ".".join(str(p) for p in e.path) if e.path else None
205205

206-
self.errors.append(
207-
ValidationError(
208-
"SCHEMA_ERROR",
209-
f"Schema validation error: {e.message}",
210-
field=path,
211-
location=str(e.schema_path) if e.schema_path else None,
206+
self.errors.append(
207+
ValidationError(
208+
"SCHEMA_ERROR",
209+
f"Schema validation error: {e.message}",
210+
field=path,
211+
location=str(e.schema_path) if e.schema_path else None,
212+
)
212213
)
213-
)
214-
except Exception as e:
215-
self.errors.append(
216-
ValidationError(
217-
"VALIDATION_ERROR", f"Error during schema validation: {str(e)}"
214+
except Exception as e:
215+
self.errors.append(
216+
ValidationError(
217+
"VALIDATION_ERROR",
218+
f"Error during schema validation: {str(e)}",
219+
)
218220
)
219-
)
220221

221222
# Perform format-specific validations
222223
self._perform_format_specific_validation(raw_data, vex_type)

0 commit comments

Comments
 (0)