Skip to content

Commit

Permalink
feat(deprecation) Return actor entity with deprecation aspect (#10832)
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscollins3456 authored Jul 2, 2024
1 parent 286a3cc commit f067573
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import com.linkedin.datahub.graphql.generated.DataQualityContract;
import com.linkedin.datahub.graphql.generated.Dataset;
import com.linkedin.datahub.graphql.generated.DatasetStatsSummary;
import com.linkedin.datahub.graphql.generated.Deprecation;
import com.linkedin.datahub.graphql.generated.Domain;
import com.linkedin.datahub.graphql.generated.ERModelRelationship;
import com.linkedin.datahub.graphql.generated.ERModelRelationshipProperties;
Expand Down Expand Up @@ -785,6 +786,7 @@ public void configureRuntimeWiring(final RuntimeWiring.Builder builder) {
configureBusinessAttributeResolver(builder);
configureBusinessAttributeAssociationResolver(builder);
configureConnectionResolvers(builder);
configureDeprecationResolvers(builder);
}

private void configureOrganisationRoleResolvers(RuntimeWiring.Builder builder) {
Expand Down Expand Up @@ -3150,4 +3152,14 @@ private void configureConnectionResolvers(final RuntimeWiring.Builder builder) {
: null;
})));
}

private void configureDeprecationResolvers(final RuntimeWiring.Builder builder) {
builder.type(
"Deprecation",
typeWiring ->
typeWiring.dataFetcher(
"actorEntity",
new EntityTypeResolver(
entityTypes, (env) -> ((Deprecation) env.getSource()).getActorEntity())));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public Deprecation apply(
@Nullable QueryContext context, @Nonnull final com.linkedin.common.Deprecation input) {
final Deprecation result = new Deprecation();
result.setActor(input.getActor().toString());
result.setActorEntity(UrnToEntityMapper.map(context, input.getActor()));
result.setDeprecated(input.isDeprecated());
result.setDecommissionTime(input.getDecommissionTime());
result.setNote(input.getNote());
Expand Down
5 changes: 5 additions & 0 deletions datahub-graphql-core/src/main/resources/entity.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -8183,6 +8183,11 @@ type Deprecation {
The user who will be credited for modifying this deprecation content
"""
actor: String

"""
The hydrated user who will be credited for modifying this deprecation content
"""
actorEntity: Entity
}

"""
Expand Down

0 comments on commit f067573

Please sign in to comment.