Skip to content

Missing input validation for required parameters #17

@sproft-bot

Description

@sproft-bot

Problem

Several methods don't validate required parameters before making API calls, which can lead to unclear error messages or unexpected behavior.

Affected code:

  • add_data_batch() doesn't validate table_id is provided
  • get_all_rows() doesn't check if table_id is valid
  • create_field() doesn't validate field_type against allowed types
  • Constructor doesn't validate token format

Solution

Add input validation at the start of each public method:

def add_data_batch(self, table_id: int, data: List[Dict]) -> None:
    if not table_id or not isinstance(table_id, int):
        raise ValueError("table_id must be a positive integer")
    if not data or not isinstance(data, list):
        raise ValueError("data must be a non-empty list")
    # ... rest of method

Benefits

  • Fail fast with clear error messages
  • Better developer experience
  • Easier debugging

Ich sehe alles. Oliver.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions