Description
The identity_match field in PhoneNumberInstance for the Lookup v2 API is incorrectly typed as Optional[str] when it should be Optional[Dict].
I noticed this as my linter was failing the type check of one of my files while performing the update from v8 to v9 because it thought the field was a string.
Current Behavior
The type annotation for identity_match is:
|
self.identity_match: Optional[str] = payload.get("identity_match") |
Expected Behavior
According to the official Twilio documentation, identity_match should be typed as:
identity_match: Optional[Dict[str, Any]]
Evidence from Official Documentation
The Twilio Lookup v2 Line Type Intelligence documentation clearly shows that identity_match is an object (dictionary).
Example response from the official docs:
"identity_match": {
"first_name_match": "exact_match",
"last_name_match": "high_partial_match",
"address_lines_match": "no_match",
"city_match": "no_match",
"state_match": "high_partial_match",
"postal_code_match": "no_data_available",
"address_country_match": "exact_match",
"national_id_match": "exact_match",
"date_of_birth_match": "exact_match",
"summary_score": 90,
"error_code": null,
"error_message": null
},
Impact
This incorrect typing leads to:
- Type checking errors when accessing nested properties (e.g.,
phone_number.identity_match["summary_score"])
Description
The
identity_matchfield inPhoneNumberInstancefor the Lookup v2 API is incorrectly typed asOptional[str]when it should beOptional[Dict].I noticed this as my linter was failing the type check of one of my files while performing the update from v8 to v9 because it thought the field was a string.
Current Behavior
The type annotation for
identity_matchis:twilio-python/twilio/rest/lookups/v2/phone_number.py
Line 77 in 9f783d9
Expected Behavior
According to the official Twilio documentation,
identity_matchshould be typed as:Evidence from Official Documentation
The Twilio Lookup v2 Line Type Intelligence documentation clearly shows that
identity_matchis an object (dictionary).Example response from the official docs:
Impact
This incorrect typing leads to:
phone_number.identity_match["summary_score"])