Skip to content

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

Open
@buntagonalprism

Description

@buntagonalprism

Documentation / Feature Proposal
The fix in #217 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
    inputs:
      projects: |
        **/*.csproj
        !**/*Test.csproj   

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions