singer-tools
singer-tools copied to clipboard
format: "date-time" under an ["object", "null"] type yields AttributeError
given a schema:
{
"type": "object",
"properties": {
"example": {
"type": ["null", "object"],
"properties": {
"date": {
"type": "string",
"format": "date-time"
}
}
}
}
}
and input data:
{
"example": null
}
running singer-check-tap
on these inputs yields:
File "/Users/connor/.pyenv/versions/3.6.0/envs/tap-selligent/lib/python3.6/site-packages/singertools/check_tap.py", line 34, in set_defaults
if subschema['format'] == 'date-time' and instance.get(prop) is not None:
AttributeError: 'NoneType' object has no attribute 'get'
this checks that instance is not None separately to avoid this AttributeError
to whoever looks at this... happy to write a replicating unit test, but it doesn't look like there's a framework in place. lmk if/how you'd like me to do that
I just hit this issue too
+1 for a merge
Connor's code works for me