Add the following to a property group in your .csproj:
<InterceptorsNamespaces>$(InterceptorsNamespaces);Microsoft.AspNetCore.OpenApi.Generated</InterceptorsNamespaces>
That's what the error message directs you to do and it fixed the issue for me