question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generate code on "/swagger/docs/v1" endpoint

See original GitHub issue

Given my backend service has a /swagger/docs/v1 endpoint:

image

When I try to generate the corresponding TS code, I get the following errors:

FATAL: swagger-document-override/md-override-loader - FAILED
FATAL: Error: Could not read 'https://localhost:44392/swagger/docs/v1'.
FATAL: swagger-document/loader - FAILED
FATAL: Error: Could not read 'https://localhost:44392/swagger/docs/v1'.
Process() cancelled due to exception : Could not read 'https://localhost:44392/swagger/docs/v1'.

The format is fine since I’m able to generate it if I run the tool on a local file with the same content as the one provided by the endpoint. The key difference probably resides in the fact that the endpoint uses the previous Swashbuckle endpoint that was modified in its .NET core associated project to /swagger/v1/swagger.json (instead of swagger/docs/v1 without the .json extension).

autorest --info output:

 Type       Extension Name                           Version      Location
 core       @microsoft.azure/autorest-core           2.0.4280     C:\Users\fpelletier\.autorest\@microsoft.azure_autorest-core@2.0.4280
 extension  @microsoft.azure/autorest.modeler        2.1.23       C:\Users\fpelletier\.autorest\@microsoft.azure_autorest.modeler@2.1.23
 extension  @microsoft.azure/autorest.typescript     2.0.304      C:\Users\fpelletier\.autorest\@microsoft.azure_autorest.typescript@2.0.304
 extension  @microsoft.azure/autorest.typescript     2.0.330      C:\Users\fpelletier\.autorest\@microsoft.azure_autorest.typescript@2.0.330

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
RikkiGibsoncommented, Jul 10, 2018

OK-- so doing a simple HTTP GET does return you the Swagger document to use for generation, then? I will try to repro when I get a chance.

0reactions
felpelcommented, Jul 19, 2018

I will close this issue for now since the tool might not be in fault here and maybe we have to setup something on our end in order to have the endpoint available for code generation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get started with Swashbuckle and ASP.NET Core
Launch the app, and navigate to http://localhost:<port>/swagger/v1/swagger.json . The generated document describing the endpoints appears as ...
Read more >
Configuring and Using Swagger UI in ASP.NET Core Web API
SwaggerGen : A Swagger generator that builds SwaggerDocument objects directly from our routes, controllers, and models. Wanna join Code Maze ...
Read more >
A clean way to add Swagger to ASP.NET Core application
NET Core application using extension methods to make startup.cs clean and ... SwaggerEndpoint( "/swagger/v1/swagger.json" , "My API V1" );.
Read more >
How to generate OpenAPI document/SwaggerDoc for ...
Need a way to generate SwaggerDoc per controller per version. Example on end points: <cname>/v1/Employees, <cname>/v2/Employees, <cname>/v1/ ...
Read more >
domaindrivendev/Swashbuckle.AspNetCore - GitHub
SwaggerEndpoint ("v1/swagger.json", "My API V1"); }); ... Getting Started) to provide beautiful API docs that are automatically generated from your code.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found