Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use anyOf to help dates which can't format #47

Merged
merged 1 commit into from
Mar 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tap_salesforce/salesforce/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ def field_to_property_schema(field, mdata):
if sf_type in STRING_TYPES:
property_schema['type'] = "string"
elif sf_type in DATE_TYPES:
property_schema["format"] = "date-time"
property_schema['type'] = "string"
date_type = {"type": "string", "format": "date-time"}
string_type = {"type": ["string", "null"]}
property_schema["anyOf"] = [date_type, string_type]
elif sf_type == "boolean":
property_schema['type'] = "boolean"
elif sf_type in NUMBER_TYPES:
Expand Down Expand Up @@ -179,7 +180,7 @@ def field_to_property_schema(field, mdata):
raise TapSalesforceException("Found unsupported type: {}".format(sf_type))

# The nillable field cannot be trusted
if field_name != 'Id' and sf_type != 'location':
if field_name != 'Id' and sf_type != 'location' and sf_type not in DATE_TYPES:
property_schema['type'] = ["null", property_schema['type']]

return property_schema, mdata
Expand Down