-
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
fix(ingest): kafka - properly picking doc from union type #6472
fix(ingest): kafka - properly picking doc from union type #6472
Conversation
At union types we either have to get the doc from the union's doc itself (if it exists) or if it doesn't then pick it from the non null type's doc. |
@@ -289,8 +289,14 @@ def emit(self) -> Generator[SchemaField, None, None]: | |||
) | |||
|
|||
description = self._description | |||
if description is None: | |||
description = schema.props.get("doc", None) | |||
if self._schema.props.get("doc", None) is None: |
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.
Is there a simpler idiom we could use?
Something like:
schema_description = self._schema_props.get("doc") or actual_schema.props.get("doc")
description = f"{schema_description or ''}{description or ''}"
... rest of code
@@ -314,6 +322,8 @@ def emit(self) -> Generator[SchemaField, None, None]: | |||
description = ( | |||
f"<span style=\"color:red\">DEPRECATED: {merged_props['deprecated']}</span>\n" | |||
+ description | |||
if description |
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.
doesn't this effectively do the same thing you are trying to prevent above?
If description is None we set it to "" ... so why not just set description to "" above
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.
A bunch of other integration test expects this property as None and not empty string in their golden files. (like Glue, Hive, etc...) and those broke when I had empty string.
This way the output is identical what we had before.
Checklist