Currently, None is a valid argument for all API calls, but we don’t consistently handle it across the codebase. In cases where None is not explicitly supported, the function itself should take care of it internally.
To streamline this behavior, we should introduce a standardized mechanism for handling arguments. The proposed approach is to use coerce_optional_dispatch as a centralized solution for normalizing None inputs before further processing.
Benefits:
- Consistent handling of None across all APIs
- Reduces duplicated argument checks in multiple places
- Improves code readability and maintainability
- Ensures cleaner error handling and edge case management
Action items:
- Review all API functions for current None handling.
- Introduce coerce_optional_dispatch where applicable.
- Remove redundant argument validation logic.
- Add unit tests to confirm consistent handling of None inputs.