You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First and foremost, I'd like to express my gratitude for this incredible library. I'm reaching out to report a bug related to the ConnectionAdapter and the results from DataFetcher as represented by DataFetcherResult.
When I retrieve a result from DataFetcher that's an instance of DataFetcherResult with a specific local context and associated data that has its specific ConnectionAdapter, an error is generated. The system seems unable to locate the adapter. It appears to be looking for an adapter for the overall result rather than the specific data type of DataFetcherResult. Currently, there isn't an alternative method to pass the local context and the corresponding data that should be Connection and mapped by the ConnectionAdapter. This leads me to believe that there's a bug in the process.
I've managed to identify a potential solution...
In ConnectionFieldTypeVisitor in record ConnectionDataFetcher
I think it should check if result is DataFetcherResult and map only its data.
My controller is like this:
@SchemaMapping(typeName = "Parent")
public DataFetcherResult<Connection<Item>> items(final Parent parent,
final OffsetPagination pagination) {
final List<Item> items = service.getItems(parent.getId(), pagination.offset(), pagination.limit());
final Connection<Item> connection = Connection.create(items, pagination);
return DataFetcherResult.<Connection<Item>>newResult()
.localContext(GraphQLContext.newContext()
.of(LocalContextValues.PARENT, parent.id())
.build())
.data(connection)
.build();
}
The Connection class functions correctly with its ConnectionAdapter. When returning entire Connection, everything operates as expected. However, when there's a need to pass a localContext, I utilize DataFetcherResult. At this point, an issue arises because it cannot handle this specific type.
type Query {
parent: Parent!
}
type Parent {
id: ID!
items(after: String, before: String, first: NonNegativeInt, last: NonNegativeInt): ItemConnection!
}
type Item{
id: ID!
}
If needed more code or more information, tell me. Thank you for library!
The text was updated successfully, but these errors were encountered:
rstoyanchev
changed the title
ConnectionAdapter - DataFetcherResult
ConnectionDataFetcher should handle data wrapped with DataFetcherResult
Oct 13, 2023
Hello,
First and foremost, I'd like to express my gratitude for this incredible library. I'm reaching out to report a bug related to the ConnectionAdapter and the results from DataFetcher as represented by DataFetcherResult.
When I retrieve a result from DataFetcher that's an instance of DataFetcherResult with a specific local context and associated data that has its specific ConnectionAdapter, an error is generated. The system seems unable to locate the adapter. It appears to be looking for an adapter for the overall result rather than the specific data type of DataFetcherResult. Currently, there isn't an alternative method to pass the local context and the corresponding data that should be Connection and mapped by the ConnectionAdapter. This leads me to believe that there's a bug in the process.
I've managed to identify a potential solution...
In ConnectionFieldTypeVisitor in record ConnectionDataFetcher
I think it should check if result is DataFetcherResult and map only its data.
My controller is like this:
The Connection class functions correctly with its ConnectionAdapter. When returning entire Connection, everything operates as expected. However, when there's a need to pass a localContext, I utilize DataFetcherResult. At this point, an issue arises because it cannot handle this specific type.
If needed more code or more information, tell me. Thank you for library!
The text was updated successfully, but these errors were encountered: