Skip to content

Commit

Permalink
fix(structuredProps) Allow upserting structured props on schema field…
Browse files Browse the repository at this point in the history
…s that don't exist (#11466)
  • Loading branch information
chriscollins3456 committed Sep 24, 2024
1 parent 506d7a6 commit a78ef32
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.linkedin.datahub.graphql.resolvers.structuredproperties;

import static com.linkedin.datahub.graphql.resolvers.ResolverUtils.bindArgument;
import static com.linkedin.metadata.Constants.SCHEMA_FIELD_ENTITY_NAME;
import static com.linkedin.metadata.Constants.STRUCTURED_PROPERTIES_ASPECT_NAME;

import com.datahub.authentication.Authentication;
Expand Down Expand Up @@ -74,7 +75,9 @@ public CompletableFuture<com.linkedin.datahub.graphql.generated.StructuredProper
final AuditStamp auditStamp =
AuditStampUtils.createAuditStamp(authentication.getActor().toUrnStr());

if (!_entityClient.exists(context.getOperationContext(), assetUrn)) {
// schemaField entities often don't exist, create it if upserting on a schema field
if (!assetUrn.getEntityType().equals(SCHEMA_FIELD_ENTITY_NAME)
&& !_entityClient.exists(context.getOperationContext(), assetUrn)) {
throw new RuntimeException(
String.format("Asset with provided urn %s does not exist", assetUrn));
}
Expand Down

0 comments on commit a78ef32

Please sign in to comment.