Skip to content

Revisit parse_string/2 return contract for 0.4.0 #3

Description

@jeffhuen

RustyCSV.parse_string/2 currently has an option-dependent return shape:

  • default: returns rows
  • headers: true: returns maps
  • input too large: returns {:error, :input_too_large}
  • invalid options: raises ArgumentError

This is intentional for compatibility and ergonomics, but it matches Elixir's "alternative return types" design anti-pattern and makes the public contract harder to reason about.

For 0.4.0, consider introducing explicit APIs with stable return shapes, for example:

  • parse_rows_string/2
  • parse_maps_string/2
  • parse_string!/2
  • parse_maps_string!/2

Then decide whether to deprecate or change the headers: option behavior.

This should not be changed in a 0.3.x patch release because changing parse_string/2 directly would be breaking.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions