Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/JsonApiDotNetCore.OpenApi/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ private static void AddCustomApiExplorer(IServiceCollection services, IMvcCoreBu
services.TryAddSingleton<NonPrimaryDocumentTypeFactory>();
services.TryAddSingleton<ResourceFieldValidationMetadataProvider>();

services.TryAddSingleton<IApiDescriptionGroupCollectionProvider>(serviceProvider =>
// Not using TryAddSingleton, see https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1463.
services.Replace(ServiceDescriptor.Singleton<IApiDescriptionGroupCollectionProvider>(serviceProvider =>
{
var actionDescriptorCollectionProvider = serviceProvider.GetRequiredService<JsonApiActionDescriptorCollectionProvider>();
var apiDescriptionProviders = serviceProvider.GetRequiredService<IEnumerable<IApiDescriptionProvider>>();

return new ApiDescriptionGroupCollectionProvider(actionDescriptorCollectionProvider, apiDescriptionProviders);
});
}));

mvcBuilder.AddApiExplorer();

Expand Down