Fix error reading from url 'Could not read 'http://...'' during generating AutoRestClient in Storefront

Sometimes, during generating autorest client of your module using Swagger, the error 'Could not read ‘http://…’ could appear.
To prevent this error you have to generate Swagger description as a json file at first.
And then use it as -input parameter for generating autorest client, ex.:

iwr http://localhost/admin/docs/CustomerReviewsModule.Web/v1 -outfile swagger.CustomerReviewsModule.Web.json
$modules = @('CustomerReviewsModule.Web')
   $modules.ForEach( { autoRest -Input swagger.$_.json  -OutputFileName $_`ModuleApi.cs -Namespace VirtoCommerce.Storefront.AutoRestClients.$_`ModuleApi -ClientName $_`ModuleApiClient -OutputDirectory VirtoCommerce.Storefront\AutoRestClients -AddCredentials true -UseDateTimeOffset false })
1 Like