Skip to content

Commit

Permalink
feat(graphql): get raw aspects for assertions, allow aspectNames filter
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurinehate committed Feb 7, 2024
1 parent e6d7066 commit 8841581
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2436,7 +2436,9 @@ private void configureAssertionResolvers(final RuntimeWiring.Builder builder) {
? assertion.getDataPlatformInstance().getUrn()
: null;
}))
.dataFetcher("runEvents", new AssertionRunEventResolver(entityClient)));
.dataFetcher("runEvents", new AssertionRunEventResolver(entityClient))
.dataFetcher(
"aspects", new WeaklyTypedAspectsResolver(entityClient, entityRegistry)));
}

private void configurePolicyResolvers(final RuntimeWiring.Builder builder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ public class WeaklyTypedAspectsResolver implements DataFetcher<CompletableFuture
private static final JacksonDataCodec CODEC = new JacksonDataCodec();

private boolean shouldReturnAspect(AspectSpec aspectSpec, AspectParams params) {
return !params.getAutoRenderOnly() || aspectSpec.isAutoRender();
return (params.getAutoRenderOnly() == null
|| !params.getAutoRenderOnly()
|| aspectSpec.isAutoRender())
&& (params.getAspectNames() == null
|| params.getAspectNames().isEmpty()
|| params.getAspectNames().contains(aspectSpec.getName()));
}

@Override
Expand Down
12 changes: 12 additions & 0 deletions datahub-graphql-core/src/main/resources/entity.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1763,6 +1763,12 @@ input AspectParams {
Only fetch auto render aspects
"""
autoRenderOnly: Boolean

"""
Fetch using aspect names
If absent, returns all aspects matching other inputs
"""
aspectNames: [String!]
}


Expand Down Expand Up @@ -6788,6 +6794,12 @@ type Assertion implements EntityWithRelationships & Entity {
Edges extending from this entity grouped by direction in the lineage graph
"""
lineage(input: LineageInput!): EntityLineageResult

"""
Experimental API.
For fetching extra aspects that do not have custom UI code yet
"""
aspects(input: AspectParams): [RawAspect!]
}

"""
Expand Down

0 comments on commit 8841581

Please sign in to comment.