Skip to content

Conversation

@deviantintegral
Copy link
Owner

Implement HAR validation to ensure HAR files from different sources are compliant before processing.

  • Add HarValidator class with validate() and validateJson() methods
  • Add ValidationResult class to represent validation outcomes
  • Add ValidationError class with message, path, and property details
  • Validate all required fields per HAR 1.2 spec
  • Validate pageref references point to valid page IDs
  • Include comprehensive unit tests for all validation scenarios

Add ValidationError class to represent validation errors with:
- Error message describing the validation failure
- JSON path to the invalid field
- Specific property that failed validation
- getFullMessage() for formatted output with path
Add ValidationResult class to represent validation outcomes:
- isValid() to check if validation passed
- getErrors() to retrieve all validation errors
- getErrorCount() to get error count
- Static factories: valid(), invalid(), merge()
Validates HAR files against the 1.2 specification with support for:
- Validating both Har objects and JSON strings
- Checking all required fields per HAR 1.2 spec
- Validating pageref references valid page IDs
- Detailed error paths for debugging (e.g., log.entries[0].request)
- JSON structure validation before deserialization
- BOM handling for compatibility

Updates infection.json5 to ignore equivalent mutations:
- JSON depth mutations (512 vs 511 depth is equivalent)
- LessThan mutations in validateTimings (setters already validate)
- UnwrapArrayMerge mutations where first array_merge is with empty array
- ArrayOneItem mutations for validators that return 0-1 errors
@deviantintegral deviantintegral force-pushed the claude/implement-har-validation-EXoap branch from 7a94467 to 3f081af Compare January 15, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants