-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.This issue needs the attention of a contributor, typically because the OP has provided an update.feature-openapiold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Description
Describe the bug
When dotnet-openapi is used to refresh a swagger.json document, if the new document is shorter than the old document, the file is not truncated to the new size leaving invalid trailing bytes that render it un-parsable, causing build errors.
To Reproduce
- Create a new webapi project and add 2 [HttpXXX] methods to the controller.
- Run
dotnet-openapi add url https://localhost:5001/swagger/v1/swagger.json --output-file MyApi.jsonfrom a terminal. - Rebuild to verify the MyApiClient is accessible and works.
- Remove a method from the controller and rebuild and rerun.
- Run
dotnet-openapi refresh https://localhost:5001/swagger/v1/swagger.json - Verify that the MyApi.json file retains its original file and has garbage data trailing the new, shorter, swagger definition.
Further technical details
user@mac % dotnet tool list --global
Package Id Version Commands
-------------------------------------------------------------------------
dotnet-aspnet-codegenerator 2.2.3 dotnet-aspnet-codegenerator
dotnet-ef 5.0.9 dotnet-ef
dotnet-svcutil 2.0.2 dotnet-svcutil
microsoft.dotnet-openapi 5.0.9 dotnet-openapi Metadata
Metadata
Assignees
Labels
Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.This issue needs the attention of a contributor, typically because the OP has provided an update.feature-openapiold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels