able-evening-90828
11/08/2022, 1:53 AMEntity in SearchQueryResponse of a GraphQL search request?
I got the following exception when trying to turn the code below it. I used the auto generated graphql client code and I confirmed that the raw response string the client received is correct.
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of com.linkedin.datahub.graphql.generated.Entity (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
final SearchInput searchInput =
SearchInput.builder()
.setType(EntityType.DATASET)
.setQuery("")
.setStart(0)
.setCount(10)
.build();
final SearchQueryRequest searchQueryRequest =
SearchQueryRequest.builder().setInput(searchInput).build();
GraphQLResponseProjection graphQLResponseProjection =
new SearchResultsResponseProjection()
.start()
.count()
.total()
.searchResults(
new SearchResultResponseProjection()
.entity(new EntityResponseProjection().urn().type()));
GraphQLRequest graphQLRequest =
new GraphQLRequest(searchQueryRequest, graphQLResponseProjection);
final SearchQueryResponse searchQueryResponse =
getRestTemplate()
.exchange(
URI.create(GRAPHQL_ENDPOINT),
<http://HttpMethod.POST|HttpMethod.POST>,
createHttpEntity(graphQLRequest),
SearchQueryResponse.class)
.getBody();
System.out.println(searchQueryResponse.search());
@green-football-43791 @bulky-soccer-26729incalculable-ocean-74010
11/08/2022, 5:28 PMEntity is a GraphQL auto-generated interface. You would need to create a custom deserialiser that routes to the appropriate class based on the EntityType property of the object. This is not something we have in DataHub as of right now.orange-night-91387
11/08/2022, 5:34 PMorange-night-91387
11/08/2022, 5:35 PMable-evening-90828
11/08/2022, 5:53 PMable-evening-90828
11/08/2022, 8:48 PMEntity and it worked great.
The only problem I see is the Dataset class autogenerated doesn't contain the schemaMetadata field.
I saw that it is in entity.graphql.
https://github.com/datahub-project/datahub/blob/92192d2410f9c235a4da0a57a557160704015fbe/datahub-graphql-core/src/main/resources/entity.graphql#[…]4
But for some reason, the autogenerated Dataset class doesn't contain it. Do you guys know why?orange-night-91387
11/08/2022, 9:25 PMorange-night-91387
11/08/2022, 9:27 PMable-evening-90828
04/06/2023, 10:24 PMschemaMetadata in this thread, we have also found the IngestionSource doesn't have IngestionSourceExecutionRequests as a field.
@orange-night-91387 do you see any problem if we send a PR to set generateParameterizedFieldsResolvers to false in build.gradle so the response of these parameterized queries can be generated?
In our testing, we only need to change CreateViewResolver.java because the constructor of DatahubView takes one more parameter with this change.
FYI, @gray-airplane-39227able-evening-90828
04/06/2023, 10:27 PMgraphql-java-codegen suggested this and this flag is set to false by default in 6.0.0
https://github.com/kobylynskyi/graphql-java-codegen/issues/1148orange-night-91387
04/07/2023, 4:19 PMable-evening-90828
04/07/2023, 6:58 PM