In the case that a value comes through as None or '' (empty string) for a datetime schema, the transformer was logging an error level log line, while this case was actually being parsed successfully to None (null) if the schema is marked nullable.
This short circuits datetime parsing in the case that None or '' get passed in as a value to avoid this message, and improves the log message on parse failure by reducing the level to warning and providing the failed value in parentheses after the message.
The message was made warning since the schema may have fallbacks that will cause the field to parse successfully (like anyOf with a datetime and a raw string type included).
In the case that a value comes through as
None
or''
(empty string) for a datetime schema, the transformer was logging an error level log line, while this case was actually being parsed successfully toNone
(null) if the schema is marked nullable.This short circuits datetime parsing in the case that
None
or''
get passed in as a value to avoid this message, and improves the log message on parse failure by reducing the level to warning and providing the failed value in parentheses after the message.The message was made warning since the schema may have fallbacks that will cause the field to parse successfully (like
anyOf
with a datetime and a raw string type included).