Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is HttpRepl unable to find an OpenAPI description? The command "ls" does not show available endpoints

I am working through the Microsoft Learn tutorials to "Create a web API with ASP.Net Core".

Under the heading, "Build and test the web API", at instruction (5) I am getting a response, "Unable to find an OpenAPI description".

For step (6) when executing the "ls" command I get the response, "No directory structure has been set, so there is nothing to list. Use the 'connect' command to set a directory structure based on an OpenAPI description". I have tried the "connect" command suggested here and have tried "dir" as an alternative to "ls".

I can successfully change directories in step (7) and execute the GET request for step (8) and receive the expected reply. However, it really bothers me the "ls" command is not working here and seems like an important function of the httprepl tool.

How can I get the "ls" command to work here or tell me why does it not work?

C:\Users\xxxx\source\repos\Learn\ContosoPizza>httprepl http://localhost:5000
(Disconnected)> connect http://localhost:5000
Using a base address of http://localhost:5000/
Unable to find an OpenAPI description
For detailed tool info, see https://aka.ms/http-repl-doc

http://localhost:5000/> ls
No directory structure has been set, so there is nothing to list. Use the "connect" command to set a directory structure based on an OpenAPI description.       

http://localhost:5000/>

ADDED RESULTS OF SUGGESTIONS--

C:\Users\xxxx\source\repos\Learn\ContosoPizza>dotnet --version
3.1.412

C:\Users\xxxx\source\repos\Learn\ContosoPizza>dotnet add WebAPI.csproj package Swashbuckle.AspNetCore -v 5.6.3
Could not find project or directory `WebAPI.csproj`.

httprepl GitHub repo and MS Docs page

like image 703
Nuse Avatar asked Dec 31 '22 12:12

Nuse


1 Answers

The solution for me was to simply trust localhost's SSL certification, which you can do with this command:

dotnet dev-certs https --trust

While doing the same Tutorial, a friend of mine noticed, that trusting the dev certificate, was already covered by the Tutorial, which I had overlooked doing the Tutorial myself. This is the official help site: Trust the ASP.NET Core HTTPS development certificate on Windows and macOS. Maybe this will still help someone with the same problem.

like image 50
yuzepe Avatar answered Jan 02 '23 00:01

yuzepe