Differentiate between `null` and missing fields in API responses
mainIn API responses, a field that is explicitly null or missing entirely will both appear as None in the SDK. To distinguish between these two cases, use the .model_fields_set attribute on the response object. If the field name is not present in model_fields_set, the key was missing from the JSON; otherwise, the key was present with a null value.
if response.my_field is None:
if 'my_field' not in response.model_fields_set:
print('Got json like {}, without a "my_field" key present at all.'.format(response.model_dump()))
else:
print('Got json like {"my_field": null}.')