domaindrivendev / Swashbuckle.AspNetCore

Swagger tools for documenting API's built on ASP.NET Core
MIT License
5.25k stars 1.31k forks source link

swagger tofile outputtting Microsoft.Extensions.Logging output to description file #2303

Closed MarkusG closed 3 months ago

MarkusG commented 2 years ago

When generating a description file (YAML or JSON), it appears that the Swagger command line tool is writing some extraneous output from the application itself into the description document. This bug only occurs when running the tool from a directory outside of the one containing the project's csproj. I noticed this occurring after adding JWT authentication to my web API. ASP.NET logged some information about storing keys locally without encryption, and that log information was written to the API description.

Reproduction repository: https://github.com/MarkusG/SwaggerCliRepro

Version: 6.2.3 (globally installed) Steps to reproduce:

  1. Create a new web API project (dotnet new webapi)
  2. Install System.IdentityModel.Tokens.Jwt and Microsoft.AspNetCore.Authentication.JwtBearer
  3. Add the authentication service in Program.cs, as shown in the linked repository
  4. Build the project
  5. Navigate to a directory other than the one containing the csproj. For example, bin
  6. Run dotnet swagger tofile Debug/net6.0/YourProject.dll v1 (or whatever other path you need, relative to where you navigated to)
  7. Observe logging output being written to the API description
github-actions[bot] commented 4 months ago

This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made.

github-actions[bot] commented 3 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.