Skip to content

Conversation

@siddhant2001
Copy link
Contributor

Adding support for description for an attribute in the AttributeMetadata class. The description is expected to be used for documentation down the line.

Default value for the new field is an empty string.

…ges to accommodate in AttributeMetadataModelTest
@siddhant2001 siddhant2001 requested a review from a team as a code owner July 16, 2024 10:38
@github-actions
Copy link
Contributor

github-actions bot commented Jul 16, 2024

Test Results

111 tests  +1   111 ✅ +1   18s ⏱️ +6s
 25 suites ±0     0 💤 ±0 
 25 files   ±0     0 ❌ ±0 

Results for commit cedce3b. ± Comparison against base commit 3d4b62f.

♻️ This comment has been updated with latest results.

…ges to accommodate in AttributeMetadataModelTest
…nto description-field-in-metadata

# Conflicts:
#	attribute-service-impl/src/test/java/org/hypertrace/core/attribute/service/model/AttributeMetadataModelTest.java
private String displayName;

@JsonProperty(value = "description")
private String description;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing documents will not have this property. We need to check if it defaults to null in that case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be fine as ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false), but lets see if we have a test for it.

.append("\",\"tenant_id\":\"")
.append(tenantId)
.append("\",\"description\":\"")
.append(scope.name())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are copying the scope.name() as the description.
Can we keep the existing tests as they are and add an additional test for the description? Since the description string is optional, the existing tests should work fine, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I've undone any changes I made to this file. Do we need separate tests for description apart from the ones added in AttributeMetadataModelTest?

+ "\"id\":\"EVENT.key\","
+ "\"value_kind\":\"TYPE_STRING\","
+ "\"display_name\":\"Display\","
+ "\"description\":\"\","
Copy link
Contributor

@kotharironak kotharironak Jul 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's without definitionAndDescription, we don't need an empty "" string, right? Are we missing something?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's without definitionAndDescription, we don't need an empty "" string, right? Are we missing something?

I think this is because the default string value is an empty string in protobuf, and this test has two parts - one from fromJson, and the second from fromDTO. Got it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add an explicit test testDescriptionBackwardsCompatibility?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reverted the testAttributeDefinitionBackwardsCompatibility to it's original state and added new tests in testAttributeDescriptionBackwardsCompatibility

private boolean internal;

@JsonProperty(value = "description")
private String description = "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private String description = "";
private String description;

kotharironak
kotharironak previously approved these changes Jul 22, 2024
@siddhant2001 siddhant2001 merged commit 8c17394 into main Jul 22, 2024
@siddhant2001 siddhant2001 deleted the description-field-in-metadata branch July 22, 2024 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants