-
-
Notifications
You must be signed in to change notification settings - Fork 799
Closed
Labels
Area: DataIssue is related to filtering, sorting, pagination or projectionsIssue is related to filtering, sorting, pagination or projectionsArea: Projections🌶️ hot chocolate
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When using resolvers / extensions it is not possible to hide a field from the schema via .Ignore() and also simultaneously .Project() that field for use in an extension.
Steps to reproduce
Assume a model where we have a book type, this contains a "GoodreadsId" field that links to an ID on the good reads service and a resolver which uses their API to return extra data. Exposing this ID to the user isn't useful, but we need it to query the remote service.
Using .IsProjected() always adds to the query as expected.
Using .Ignore() hides the field from the schema as expected.
Using .Ignore() and .IsProjected() hides the field from the schema but does not add to the query.
public class BookType : ObjectType<Book>
{
protected override void Configure(IObjectTypeDescriptor<Book> descriptor)
{
descriptor.Field(f => f.GoodreadsId)
.Ignore()
.IsProjected();
}
}
[ExtendObjectType(typeof(Book))]
public class BookExtensionsType
{
public async Task<GoodreadsData> GetGoodreadsData([Parent] Book book)
{
// book.GoodreadsId is always null
}
}Relevant log output
No response
Additional Context?
No response
Product
Hot Chocolate
Version
11.3.7
kondelik, XardasLord, horse315, MarcelMalik, kpko and 20 moresabuydee, michelbieleveld and mauriciomoccelin
Metadata
Metadata
Assignees
Labels
Area: DataIssue is related to filtering, sorting, pagination or projectionsIssue is related to filtering, sorting, pagination or projectionsArea: Projections🌶️ hot chocolate