swagger-document-override/md-override-loader - FAILED

1k views Asked by At

I am able to generate code using Autorest with my api when I host it on a server 2012R2 running IIS

However when I try to run it with the localhost url I get a could not read message.

I can read swagger.json in the browser

I am using the command

autorest --input-file=https://localhost:44348/api-docs/v1/swagger.json
--output-folder=generated --csharp --namespace=DD.MyApp.Connector

The output is

AutoRest code generation utility [version: 2.0.4283; node: v10.11.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
   Loading AutoRest core      'C:\Users\kirst\.autorest\@[email protected]\node_modules\@microsoft.azure\autorest-core\dist' (2.0.4289)
   Loading AutoRest extension '@microsoft.azure/autorest.csharp' (~2.3.79->2.3.82)
   Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.55->2.3.55)
FATAL: swagger-document-override/md-override-loader - FAILED
FATAL: Error: Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.
FATAL: swagger-document/loader - FAILED
FATAL: Error: Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.
Process() cancelled due to exception : Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.
  Error: Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.

After studying the issue on github I tried starting the api using dotnet run but it did not help.

I tried running autorest in a dos command shell with admin priviledge

As per the github issue I can save the swagger.json to a file and generate the code by referencing the file.

That isn't a great solution.

1

There are 1 answers

1
Garrett Serack On

Are you attempting to use https with localhost ? If you haven't put a certificate on there, you shouldn't be using https.

Try it with http://localhost...