Closed soroshsabz closed 8 months ago
@dolauli How to resolve this problem?
thanks
@dolauli Do you can see my problem?
thanks a lot :)
@BethanyZhou Did you can help me?
thanks
@soroshsabz since you did not provide the swagger, I guess the root is you did not specify host in the swagger. And here is an example.
@dolauli Yes your right
I correct this in https://github.com/BSVN/IpTables.Api/pull/36 with below code
// Add host to generated swagger file (swagger.json)
options.AddServer(new OpenApiServer {
Url = "http://{serverAddress}",
Description = "IpTables Test Server",
Variables = new Dictionary<string, OpenApiServerVariable>
{
{ "serverAddress", new OpenApiServerVariable {
Default = "192.168.21.56:8080",
Description = "Target Server Address" }
}
}
});
But I hope to autorest.Powershell make better error message for some errors like this
thanks again for helping me
ITNOA
When I want to generate PowerShell module from my swagger
I try to run
Generate-PowerShellClient.ps1
and see below logsas you can see above, autorest PowerShell extension generate my module without any errors
then When I try to build this module with
build-module.ps1
, I got below errorsAfter I some investigation, I found my errors exist because autorest powershell module use
$host
variable inIpTables.Api\Source\BSN.IpTables.Cli\generated\generated\api\BsnIPTablesCli.cs
, like belowand this form of variable does not exist and invalid format in C#
My code exist in https://github.com/BSVN/IpTables.Api/pull/22