singer-tools icon indicating copy to clipboard operation
singer-tools copied to clipboard

format: "date-time" under an ["object", "null"] type yields AttributeError

Open cmcarthur opened this issue 7 years ago • 2 comments

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

cmcarthur avatar May 31 '17 16:05 cmcarthur

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

cmcarthur avatar May 31 '17 16:05 cmcarthur

I just hit this issue too

+1 for a merge

Connor's code works for me

awm33 avatar Dec 27 '17 19:12 awm33