azure-functions-openapi-extension: swagger.json missing "paths" when deployed as Azure Functions from DevOps

This works locally and works when I publish from VS directly to Azure Functions.

When I run this through DevOps Build Pipeline and Release to Azure Functions everything is working except the “paths” property in the swagger.json file is empty.

Windows target system.

{
  "swagger": "2.0",
  "info": {
    "title": "Azure Functions OpenAPI Extension",
    "version": "1.0.0"
  },
  "host": "........azurewebsites.net",
  "basePath": "/api/v1",
  "schemes": [
    "https"
  ],
  "paths": { }
}

No errors in the Azure Functions LogStream.

2021-06-30T21:02:59.179 [Information] Executing ‘Functions.RenderSwaggerDocument’ (Reason=‘This function was programmatically called via the host APIs.’, Id=000000-c94f-4960-9752-5557d5d998e5) 2021-06-30T21:02:59.180 [Information] swagger.json was requested. 2021-06-30T21:02:59.180 [Information] Executed ‘Functions.RenderSwaggerDocument’ (Succeeded, Id=000000-c94f-4960-9752-5557d5d998e5, Duration=1ms)

What reasons might prevent the “paths” property from populating? I assume it’s dynamically generated at runtime?

Does it require any write permissions to the file system for instance?

It’s hard to debug as it doesn’t appear to show any errors.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

@justinyoo I prepared the minimum code to send over to you, but then decided to review your yaml settings beforehand.

I noticed that you was performing a restore, build and publish (artifacts) separately and thought I should try this too.

I setup my pipeline in the same way, with the following:

  • dotnet restore . (retrieves resources/packages)
  • dotnet build <project file> -c Release (builds project)
  • dotnet publish <project file> -c Release -o <output folder> (not entirely sure this is necessary, but it basically moves the build files to a publish folder)
  • archive to zip (compresses published build folder, may not be necessary as publish option can zip files)
  • publish build artifacts (published to a artifacts folder reader for a release pipeline to push to Azure)

Interestingly this solved the issue… at least it worked when I tested just now 👍

I guess there’s no need to send the minimum code now 😃

It’s odd that the issue exists though and it’s not entirely clear why, happy to investigate further but it does appear to be build related.

Thanks @justinyoo for your help with this matter.