swagger-ui
swagger-ui copied to clipboard
.NET 9.0 OpenAPI - Could not resolve pointer: /components/schemas/ does not exist in document
Q&A (please complete the following information)
- OS: Windows 11
- Browser: Edge
- Version 131.0.2903.51
- Swashbuckle.AspNetCore.SwaggerUi Version 7.0.0
- Visual Studio Version 17.13.0 Preview 1.0
- Aspire Starter App .NET 9.0
Content & configuration
I followed the instructions at this link: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/using-openapi-documents?view=aspnetcore-9.0
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("/openapi/v1.json", "v1");
});
Describe the bug you're encountering
When I navigate to /swagger everything appears normal. When I click on any of the 'GET' panes I get errors for all the end points:
Could not resolve reference: Could not resolve pointer: /components/schemas/ does not exist in document
Figured out the issue. I was returning a List of EFCore models that contained navigation properties. I created a DTO that did not have navigation properties and it works fine.