-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty swagger when using v0.9.0 with solution that includes a test project #306
Comments
@buntagonalprism Thanks for the tip! I will take a further look. Based on your research and suggestion, I would update the document for now so that others can avoid the similar situations. |
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. |
@buntagonalprism thanks for the work around for this issue. I was wondering how you run your tests in your pipeline if you are not building the test project? |
@Alan-Hinton apologies for not replying sooner, I was on holidays at the time of your message. There is no need to build the test project, the test runner will do what it needs to in order to run the tests. In our current pipeline rather than using the exclude rule Extract from our YAML pipeline: - task: DotNetCoreCLI@2
displayName: Build project
inputs:
command: 'build'
projects: |
SRC_PROJECT_NAME/SRC_PROJECT_NAME.csproj
arguments: --output build_output --configuration Release
- task: DotNetCoreCLI@2
displayName: Run tests
inputs:
command: 'test'
projects: '**/*Tests.csproj'
publishTestResults: true
arguments: '--collect:"XPlat Code Coverage"' |
please note the initial pattern specified in this issue point to **/*Test.csproj instead of **/*Tests.csproj Just in case you copy and paste like I did :) |
The current situation feels problematic. |
I agree with @jasiozet, at this point in time we are still not able to deploy our tests with our code. This remains an issue.. |
Please fix this. Not able to access the swagger UI in 2023 because of this issue. |
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.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:
The text was updated successfully, but these errors were encountered: