Swashbuckle.AspNetCore icon indicating copy to clipboard operation
Swashbuckle.AspNetCore copied to clipboard

Implicitly use output of project when running dotnet swagger

Open kant2002 opened this issue 6 years ago • 3 comments

When running dotnet swagger tofile you should always specify assembly where to look for the Open API definitions. Would be good if the path would be automatically constructed based on the a) project path b) project configuration

Since many projects follow conventions when specify names, this allow easier way to specify command lines. Also this is more in line with dotnet tooling itself.

Original command

dotnet swagger tofile --output api.json bin/Debug/netcoreapp2.1/Api.dll v1

Proposed variants

dotnet swagger tofile --output api.json -p . v1
# dotnet swagger tofile --output api.json ./bin/Debug/{anyfolder}/{DirectoryName}.dll v1
dotnet swagger tofile --output api.json -p . -c Release v1
# dotnet swagger tofile --output api.json ./bin/Release/{anyfolder}/{DirectoryName}.dll v1

By default, current project folder should be used.

dotnet swagger tofile --output api.json -c Release v1
# dotnet swagger tofile --output api.json ./bin/Release/{anyfolder}/{DirectoryName}.dll v1

kant2002 avatar Sep 08 '18 18:09 kant2002