Current Behavior
When the Twitter profile retrieval endpoint returns a response containing explicit null values (e.g., {"name": null, "desc": null}), the backend crashes during Pydantic model validation. The current implementation uses Python's .get("field", "default") pattern, which only provides default values for missing keys, not for keys with null values. When a key exists but has a null value, that null is passed directly to the Pydantic model, causing a validation error and crashing the service.
Reproduction Steps:
- Make the backend automatically return null values when calling the Twitter retrieval endpoint
- Observe: The backend crashes with a Pydantic validation error when trying to process the response
- Check the logs to see the validation failure on fields that received
null instead of expected string/integer types
Expected Behavior
The backend should gracefully handle Twitter API responses containing null values without crashing. When a field contains null, the system should treat it the same as a missing field and apply appropriate default values (empty strings for text fields, 0 for numeric fields). The frontend should receive a properly formatted response, potentially with a status indicator like "suspended" or "notfound" to inform the user about the account state.
Acceptance Criteria:
Steps To Test
For this task, you do NOT have to set up Twitter API credentials. Simply showing the backend can handle null values is alright.
- Configure the backend to return null values when calling the Twitter endpoint
- Verify the backend returns a response without crashing
- Check that the response contains appropriate default values instead of
null
- Verify the frontend displays an appropriate error message (e.g., "Twitter handle is suspended")
Submission
Download https://cap.so/ to record your screen (use Studio mode). Export as an mp4, and drag and drop into an issue comment below.
Guide to submitting pull requests: https://hackmd.io/@timothy1ee/Hky8kV3hlx
Current Behavior
When the Twitter profile retrieval endpoint returns a response containing explicit
nullvalues (e.g.,{"name": null, "desc": null}), the backend crashes during Pydantic model validation. The current implementation uses Python's.get("field", "default")pattern, which only provides default values for missing keys, not for keys withnullvalues. When a key exists but has anullvalue, thatnullis passed directly to the Pydantic model, causing a validation error and crashing the service.Reproduction Steps:
nullinstead of expected string/integer typesExpected Behavior
The backend should gracefully handle Twitter API responses containing
nullvalues without crashing. When a field containsnull, the system should treat it the same as a missing field and apply appropriate default values (empty strings for text fields, 0 for numeric fields). The frontend should receive a properly formatted response, potentially with a status indicator like "suspended" or "notfound" to inform the user about the account state.Acceptance Criteria:
nullvalues without crashingnullvalues are converted to appropriate defaults (empty strings for text, 0 for numbers)nullvaluesSteps To Test
For this task, you do NOT have to set up Twitter API credentials. Simply showing the backend can handle null values is alright.
nullSubmission
Download https://cap.so/ to record your screen (use Studio mode). Export as an mp4, and drag and drop into an issue comment below.
Guide to submitting pull requests: https://hackmd.io/@timothy1ee/Hky8kV3hlx