fix(ingest): serialization - tighten conditions for restli json transformation (#3973)

This commit is contained in:
Harshal Sheth 2022-01-26 00:56:04 -05:00 committed by GitHub
parent 8dbde4bf0d
commit ea5a66bbc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,10 +5,10 @@ from typing import Any
def pre_json_transform(obj: Any) -> Any:
if isinstance(obj, (dict, OrderedDict)):
if len(obj.keys()) == 1:
key = list(obj.keys())[0]
key: str = list(obj.keys())[0]
value = obj[key]
if key.find("com.linkedin.pegasus2avro.") >= 0:
new_key = key.replace("com.linkedin.pegasus2avro.", "com.linkedin.")
if key.startswith("com.linkedin.pegasus2avro.") >= 0:
new_key = key.replace("com.linkedin.pegasus2avro.", "com.linkedin.", 1)
return {new_key: pre_json_transform(value)}
if "fieldDiscriminator" in obj: