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.

Empty swagger when using v0.9.0 with solution that includes a test project

See original GitHub issue

Documentation / Feature Proposal The fix in to detect the root project has definitely resolved some of the issues with the generated swagger document being empty.

However immediately after upgrading to v0.9.0-preview, using .NET 5 isolated functions, our swagger was empty when our function app was built and deployed from Azure Pipelines. The root cause turned out to be that the fix in #217 was treating our test project as the root project. I suppose this is technically correct since the test project referenced all our other projects.

We were able to work around the issue by updating the build task in our Azure Pipelines yaml file to skip building test projects, so there was no .deps.json produced to be incorrectly detected as the root project.

  - task: DotNetCoreCLI@2
    displayName: Build project
      projects: |

I thought I’d raise this issue in case anyone else was still having problems with empty swagger, and to propose either of the following solutions to help prevent others encountering the same problem:

  • A documentation update to explicitly state that test projects should not be built for swagger generation to work
  • A feature that the root project detection should ignore test projects

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

DanMannManncommented, Nov 11, 2021

Facing the same issue here, using 3.1 Functions and 0.9.0

Looking over #217, it would be a little slower but I’d suggest to load the discovered runtimes and scan for an assembly attribute e.g. OpenApiRootAttribute, to allow developers to override the automatic discovery behaviour.

jasiozetcommented, Sep 20, 2022

The current situation feels problematic. What about scenarios where you have to build and deploy tests, have anyone found other workarounds?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swagger 'swagger.json' loads, but 404 error on swagger UI ...
To serve the Swagger UI at the app's root (http://localhost:/), set the RoutePrefix property to an empty string. The default is "/swagger"; ...
Read more >
Swagger UI page is blank on localhost IISExpress SSL URL
I am developing a v5.0.6 ASP.NET Core WebApi and included Swashbuckle.AspNetCore Swagger with SwaggerUI enabled. I am developing with Visual ...
Read more >
OpenAPI 3 Library for spring-boot
OpenAPI 3 Library for spring boot projects. Is based on swagger-ui, to display the OpenAPI description.Generates automatically the OpenAPI file.
Read more >
Nestjs swagger request body. Q&A for work. Follow. dto. Th
Empty object when using DTO with multipart/form-data on NestJS. ... Start using @nestjs/swagger in your project by running `npm i …
Read more >
Swagger UI Configuration
The swagger-config.yaml in the project root directory, if it exists, is baked into the application; configuration object passed as an argument to Swagger...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found