-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat(ingest): fix handling of unions with aliases in post restli conversion #7058
feat(ingest): fix handling of unions with aliases in post restli conversion #7058
Conversation
} | ||
if ( | ||
not pre | ||
and set(obj.keys()) == {"cost", "costType"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this check continue to work if we evolve the schema of the CostModel in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no they won't work
I've added a bit more testing that will alert us any time the assumptions made here are violated by changes in the model
new_key: _json_transform(value, from_pattern, to_pattern, pre=pre) | ||
} | ||
|
||
if pre: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - we can address later. "pre" is a somewhat general name for this argument. It would be useful to change name or provide docs about it as method docs for the json_transform method.
# Note that "CostCostClass" is the only usage of a union with aliases in our | ||
# current PDL / metadata model, so the below hardcoding works. | ||
# Because this method is brittle and prone to becoming stale, we validate | ||
# the aforementioned assumption in our tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome call out and docs. Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM...!
Checklist