-
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): Support protobuf description for enum field #11027
feat(ingest): Support protobuf description for enum field #11027
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe recent changes enhance the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- metadata-integration/java/datahub-protobuf/src/main/java/datahub/protobuf/model/ProtobufField.java (5 hunks)
- metadata-integration/java/datahub-protobuf/src/main/java/datahub/protobuf/visitors/field/ProtobufExtensionFieldVisitor.java (3 hunks)
Additional comments not posted (10)
metadata-integration/java/datahub-protobuf/src/main/java/datahub/protobuf/visitors/field/ProtobufExtensionFieldVisitor.java (6)
38-44
: Refactored method improves readability and maintainability.The
visitField
method has been refactored to call helper methods for tag and glossary term associations and to encapsulate the logic for creating aSchemaField
. This improves readability and maintainability.
46-64
: Well-structured method for creatingSchemaField
.The
createSchemaField
method consolidates the logic for setting various properties of theSchemaField
, improving code clarity and maintainability.
66-78
: Isolated logic for generating field descriptions.The
createFieldDescription
method effectively isolates the logic for generating field descriptions, especially for enum types, improving readability and maintainability.
80-93
: Isolated logic for appending enum values and comments.The
appendEnumValues
method effectively isolates the logic for appending enum values and their comments to the description string, improving readability and maintainability.
95-108
: Isolated logic for retrieving and processing tag associations.The
getTagAssociations
method effectively isolates the logic for retrieving and processing tag associations, improving readability and maintainability.
110-119
: Isolated logic for retrieving and processing glossary term associations.The
getGlossaryTermAssociations
method effectively isolates the logic for retrieving and processing glossary term associations, improving readability and maintainability.metadata-integration/java/datahub-protobuf/src/main/java/datahub/protobuf/model/ProtobufField.java (4)
320-322
: Correctly identifies enum fields.The
isEnum
method correctly identifies if a field is of enum type by comparing the field's type toTYPE_ENUM
.
324-335
: Correctly retrieves enum descriptor.The
getEnumDescriptor
method correctly retrieves the enum descriptor for enum fields by extracting the short enum type name and finding the matching enum descriptor.
337-341
: Correctly retrieves enum values.The
getEnumValues
method correctly retrieves the enum values for enum fields by callinggetEnumDescriptor
and getting the value list.
343-369
: Correctly retrieves enum values and comments.The
getEnumValuesWithComments
method correctly retrieves the enum values and their associated comments for enum fields by mapping the enum values to their comments using the source code locations.
Very nice! Please add or update 1 unit test with an enum. Thanks! |
@david-leifker Thank you for your time and assistance. I added a test case for enum in proto, so please take another look! 9a76918 |
Thanks! |
Checklist
Summary
This PR introduces support for displaying descriptions for enum fields in Protobuf schemas during ingestion in DataHub. A new method has been added to ensure these descriptions are properly captured and shown.
Screenshots
As-Is:
Enum field descriptions are not displayed during Protobuf ingestion.
To-Be:
Enum field descriptions are now correctly displayed.
Summary by CodeRabbit
visitField
method for better clarity and modularity, resulting in improved code maintainability.