Closed chamook closed 2 weeks ago
@chamook Thanks for the detailed issue! I'll have a look and see if I can figure out what's going wrong here.
@chamook just looking at the test-classes I see you're using
Changing TestPage
to:
public sealed record TestPage(IReadOnlyList<Divider> Components);
and adjusting the test code to work with that can get all the items successfully on 8.3.0:
dotnet run
Building...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5250
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: /Users/some-path/Frontend.WebApp
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
Failed to determine the https port for redirect.
info: Frontend.WebApp.Controllers.TestController[0]
Testing contentful...
info: System.Net.Http.HttpClient.ContentfulClient.LogicalHandler[100]
Start processing HTTP request GET https://cdn.contentful.com/spaces/<redacted>/environments/redesign/entries?content_type=staticPage&fields.slug=test-page&include=2
info: System.Net.Http.HttpClient.ContentfulClient.ClientHandler[100]
Sending HTTP request GET https://cdn.contentful.com/spaces/<redacted>/environments/redesign/entries?content_type=staticPage&fields.slug=test-page&include=2
info: System.Net.Http.HttpClient.ContentfulClient.ClientHandler[101]
Received HTTP response headers after 171.6556ms - 200
info: System.Net.Http.HttpClient.ContentfulClient.LogicalHandler[101]
End processing HTTP request after 182.9215ms - 200
info: Frontend.WebApp.Controllers.TestController[0]
Direction: up
info: Frontend.WebApp.Controllers.TestController[0]
Direction: down
info: Frontend.WebApp.Controllers.TestController[0]
Direction: up
info: Frontend.WebApp.Controllers.TestController[0]
Direction: down
Is there a preferred way of dealing with references to heterogenous content types that isn't using dynamic
? Because that would be great 😀
Ah great, yeah the dynamics has been a headache unfortunately. However if you have a scenario where you get a number of different content types returned in a single request and want to turn them all into their respective type you need to use a ContentTypeResolver. Here's an example that should still be reasonably up to date: https://www.contentful.com/developers/docs/net/tutorials/using-net-cda-sdk/#get-entries-of-multiple-types-or-by-interface
Hope this helps!
That works 😀
Thank you very much for your help!
I have an entry with a multi reference field that might contain duplicate entries. Newer versions of the library return null for the repeated entries instead of the expected object.
I saw this issue and can get it to work as expected by using 8.0.1
This is my first time working with Contentful, so by all means tell me that I'm holding it wrong if that's the case 😅 but I think the regression between versions hints at it being a real issue and not just me
Test Code:
Test Results:
8.2.0:
8.3.0
8.1.0
8.0.1
Raw API Response: