-
-
Notifications
You must be signed in to change notification settings - Fork 158
PrimaryResourceType is null and giving error "Expected IJsonApiRequest.PrimaryResourceType not to be null at this point." #1519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @AnushreeSoman21, thanks for reaching out. I'm not seeing anything wrong in what you've described. Can you share a minimal repro project so I can analyse what's happening? |
I have used your sample project only but still facing the same issue. Attached sample project here |
Thanks, that explains a lot! This issue should have started with: I'm trying to hack in OpenAPI support, but can't get that to work. You're running into the exact same problem as reported in #1285, which you already linked to. Apparently, you added If you'd like to use OpenAPI, pick the experimental version from our dev feed and install as described here. See also the documentation on using OpenAPI. Otherwise, just removing the lines you added: builder.Services.AddControllers();
builder.Services.AddSwaggerDocument();
builder.Services.AddEndpointsApiExplorer(); makes your repro work just fine. |
Hi @bkoelman, Thank you for the response. I have tried removing below lines of code and swagger support but still it is not working for me. builder.Services.AddControllers(); and swagger support but still it is not working for me. app.UseOpenApi(); |
Can you be more specific? What have you tried exactly? Does the GettingStarted sample work on your machine? If not, can you try adding things from your project one-by-one until it breaks? What you can also try is clearing caches, restart your IDE, etc. |
Closing due to inactivity. Please provide the requested information if you need this issue to be reopened. |
SUMMARY
I attempted to create an API using JsonAPIDotNetCore, however I was receiving an exception with the message "Expected IJsonApiRequest.PrimaryResourceType not to be null at this point" when I tried to call the GetAsync API for an entity.
DETAILS
I have developed controllers by inheriting BaseJsonapicontroller exactly like below and am attempting to call the GetAsync API. I am using Jsonapidotnetcore 5.5.1,.NET 8, and EFCore 8. This gives the error as "Expected IJsonApiRequest.PrimaryResourceType not to be null at this point."
Controller -
public class DemoController : BaseJsonApiController<Demo, long>
VERSIONS USED
I've looked over one of the jsonapidotnetcore issues in your problem list and have attempted the same solutions, but nothing has worked. (PrimaryResourceType not to be null at this point #1285)
Note: I have recently updated the API from .NET 6 to .NET8 and JsonAPIDotNEtCore package from 5.1.0 to 5.5.0
The text was updated successfully, but these errors were encountered: