Closed PeteDuncanson closed 5 years ago
Yeah, the problem exists because ancestors
, children
, siblings
and content pickers returns an array of PublishedContent
which all types implement.
I'm not sure if we can do anything about this since all we do is return the items and then GraphQL for .NET handles the rest.
Is a children filter by content type possible? Here is a query where I filter children by name but I would like to filter by contentType instead. query { content { byType { Homepage(id: 1156) { ...MyPage _children(filter: {_name_not: "Page Components"}) { items { ...MyPage } } } } } } fragment MyPage on umb_PublishedContent { _id _name _url _contentType { alias } }
As mentioned in the PR I don't think it's a good idea to filter out items as it's incosistent with how GraphQL works in general and there's a lot of places it needs to be handlen and it would be something you need to handle with your custom types too
Trying to get all the ancestors of a content item will return me an array of items:
Returns:
If I want to try to convert that to a Type some odd things happen.
1) If I have multiple items of different Types it will return the non-matching items in the array as empty objects rather than strip them out as I would expect. This might be correct as the conversion happens within the loop over the items? Sadly I can't repeat this in the demo as everything is in the root.
2) If I try to convert to a Type that matched none of the content then I still get an empty item back, it doesn't return an empty array. This is actually the same issue as above but just fudged a bit (should it tell me in an error that it can't convert or find anything for that Type for instance? This is repeatable in the demo like so:
returns: