-
Notifications
You must be signed in to change notification settings - Fork 220
Open
Labels
v2Version 2 related issuesVersion 2 related issues
Description
Overview
Add configuration options to control parsing strictness, allowing users to choose between robust/permissive parsing (default) and strict standards-compliant parsing.
Tasks
Define Strictness Options
- Identify specific behaviors to make configurable:
- Date format parsing (allow non-standard formats vs RFC-compliant only)
- Required field validation (ignore vs error on missing required fields)
- Unescaped markup handling (attempt to parse vs error)
- Unknown elements (ignore vs error)
- Namespace validation
- Character encoding issues
Implementation
- Add flags to
StrictnessOptionsstruct - Update parsers to check strictness settings
- Ensure default remains permissive for backward compatibility
- Document each strictness option clearly
Example Usage
opts := &gofeed.ParseOptions{
StrictnessOptions: gofeed.StrictnessOptions{
AllowInvalidDates: false, // Reject non-standard dates
AllowMissingRequired: false, // Error on missing required fields
AllowUnescapedMarkup: false, // Don't try to fix broken markup
},
}
feed, err := parser.Parse(reader, opts)Benefits
- Users can choose appropriate level of strictness for their use case
- Helps identify feed quality issues when needed
- Maintains backward compatibility with permissive defaults
- Better standards compliance when required
Related Issues
- Part of v2 RFC (RFC: gofeed v2 – Proposed Changes #241)
- Works with error handling (v2: Improve error handling with typed errors and context #255)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
v2Version 2 related issuesVersion 2 related issues