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.

Generated Swagger is Empty

See original GitHub issue

I have an existing .NET 6 Project I’ve been working on, and I decided to add the OpenAPI Extension and generate a swagger, however the swagger generated is empty. I have cleaned and rebuilt, I have deleted obj and bin, I have tried everything, but my same functions copied to another project work just fine, but for some reason in this project, which has no build errors whatsoever (with all trace logs on), continues to generate an empty swagger.json.


    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.OpenApi" Version="0.7.2-preview" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
    <PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="6.12.2" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.13" />
    <PackageReference Include="Microsoft.OpenApi.CSharpAnnotations.DocumentGeneration" Version="2.0.0-beta02" />
    <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.12.2" />

One of my test functions:

        [OpenApiOperation(operationId: "Run", tags: new[] { "name" })]
        [OpenApiParameter(name: "name", In = ParameterLocation.Query, Required = true, Type = typeof(string), Description = "The Name parameter")]
        [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")]
        public static async Task<IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
            ILogger log)
            log.LogInformation("C# HTTP trigger function processed a request.");

            string name = req.Query["name"];

            string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            dynamic data = JsonConvert.DeserializeObject(requestBody);
            name = name ?? data?.name;

            string responseMessage = string.IsNullOrEmpty(name)
                ? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response."
                : $"Hello, {name}. This HTTP triggered function executed successfully.";

            return new OkObjectResult(responseMessage);

Generated Swagger.Json:

  "swagger": "2.0",
  "info": {
    "title": "Azure Functions OpenAPI Extension",
    "version": "1.0.0"
  "host": "localhost:7071",
  "basePath": "/api",
  "schemes": [
  "paths": { }

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

level120commented, Sep 3, 2021

I think this issue similar There is a bug and fixed recently but not deployed now.

justinyoocommented, Sep 3, 2021

@VTR-AReed How many *.deps.json files does your Debug/net6.0/ or Debug/net6.0/bin directory have? If there are multiple *.deps.json files, it’s causing the issue.

Could you confirm that on your end?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swagger api listing is empty
My assumption is swagger couldn't scan my api list from Resource package. But could not figure out which configuration or which code snippet...
Read more >
Generating empty spec · Issue #1350 · go-swagger/ ...
Problem statement When I call swagger on a package, foo it does not do anything. I have annotations like: // Package main Mytitle....
Read more >
parameter still generated even if empty in openapi: 3.0.1
Hello, i have an issues with is with generating an empty parameter when using openapi: 3.0.1. so here are 2 snipets (you can...
Read more >
Get started with Swashbuckle and ASP.NET Core
SwaggerGen : a Swagger generator that builds SwaggerDocument objects directly from your routes, controllers, and models.
Read more >
A blank path prevents Swagger from working in the API ...
... Editor to be empty but the Swagger specification does not allow the corresponding property to be empty, so the generated Swagger document...
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