Skip to content

Incorrect Type Definition: Payment.id should be 'str', not 'Optional[str]' in the response #684

Description

@NandoSangenetto

Description

I encountered a type mismatch between the Finch Python SDK and the official Finch API documentation regarding the payment.id field.

Currently, the SDK defines payment.id as str | None (Optional). However, the Official API Documentation for Payroll Payment specifies that the id field is a unique UUID and is strictly required (it does not indicate it can be null or undefined).

references

Current Behavior

When using strict type checking (e.g., Mypy or Pyright), accessing payment.id triggers a warning that the value could be None.

# Example of unnecessary boilerplate currently required
if payment.id:
    process_payment(payment.id) # Mypy is happy
else:
    # Dead code path that theoretically shouldn't exist
    raise ValueError("Payment ID is missing")

Expected Behavior

The id field on the Payment object for the response should be typed as str (required). This aligns with the API contract and removes the need for unnecessary null checks in consumer code.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

SDKbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions