Skip to content

Conversation

@mmcdole
Copy link
Owner

@mmcdole mmcdole commented May 26, 2025

Overview

This PR implements the foundation for ParseOptions as specified in #244. It establishes the basic structure and API changes needed for v2, with some features left for future implementation.

What's Implemented

Core ParseOptions Structure

  • Created ParseOptions struct with all fields from the RFC
  • Added RequestOptions sub-struct for HTTP configuration
  • Added StrictnessOptions for parsing behavior control

API Updates

  • All parsers now accept *ParseOptions parameter (can be nil)
  • Changed ParseURL to context-first: ParseURL(ctx, url, opts)
  • Removed ParseURLWithContext - context is now always required
  • Updated translators to accept ParseOptions for future extensibility

Basic Features

  • MaxItems limiting - implemented at parse level (not translation)
  • KeepOriginalFeed - stores format-specific feed in Feed.OriginalFeed
  • UserAgent and AuthConfig support in ParseURL
  • Client and Timeout configuration

Left for Future PRs

Breaking Changes

  1. All Parse methods now require *ParseOptions:

    // Old
    feed, err := parser.Parse(reader)
    
    // New
    feed, err := parser.Parse(reader, nil)  // nil for defaults
  2. ParseURL is now context-first:

    // Old
    feed, err := parser.ParseURL(url)
    feed, err := parser.ParseURLWithContext(url, ctx)
    
    // New
    feed, err := parser.ParseURL(context.Background(), url, nil)

Testing

All existing tests have been updated and are passing. The API is ready for use, though some ParseOptions fields are not yet implemented.

Closes #244

- Add ParseOptions struct with RequestOptions sub-struct matching RFC
- Update all parser methods to accept *ParseOptions parameter
- Change ParseURL to context-first signature, remove ParseURLWithContext
- Implement MaxItems limiting at parse level (not translation)
- Add KeepOriginalFeed functionality to retain format-specific data
- Update translators to accept ParseOptions for future extensibility
- Add TODO for conditional request implementation (issue #247)

Breaking changes:
- All Parse methods now require *ParseOptions (can be nil)
- ParseURL now requires context as first parameter
- Removed ParseURLWithContext method

Part of #244
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.

2 participants