-
Notifications
You must be signed in to change notification settings - Fork 198
updated cli tool to be used to generate openapi document #337
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
Conversation
@Nibell Thanks for the PR! I'll take a look and get back to you. |
Hi @Nibell! Nice one on the refactor to integrate working CLI tooling to generate swagger file. Now we wait for @justinyoo to get back to you. |
Updated pr to .net 6 @justinyoo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nibell Thanks for the long wait! It looks awesome! I left several comments for structuring.
As it's completely re-written, I need to take further look. Can you also make sure that it doesn't throw an error but shows the help message when it is run by itself, meaning azfuncopenapi.exe
with no arguments?
src/Microsoft.Azure.WebJobs.Extensions.OpenApi.CLI/ConsoleApp/GenerateSwaggerConsoleApp.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.WebJobs.Extensions.OpenApi.CLI/ConsoleApp/GenerateSwaggerConsoleApp.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.WebJobs.Extensions.OpenApi.CLI/Extension/ProjectPathExtensions.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.WebJobs.Extensions.OpenApi.CLI/Extension/SetupHostExtensions.cs
Outdated
Show resolved
Hide resolved
public class ApiMock | ||
{ | ||
public string CompiledPath { set; get; } | ||
public string CompiledDllPath { set; get; } | ||
public HttpSettings HttpSettings { set; get; } | ||
public OpenApiInfo OpenApiInfo { set; get; } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put XML comments on the class and each property?
src/Microsoft.Azure.WebJobs.Extensions.OpenApi.CLI/Service/Impl/CustomOpenApiCreator.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.WebJobs.Extensions.OpenApi.CLI/Service/Impl/CustomOpenApiWriter.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.WebJobs.Extensions.OpenApi.CLI/Service/Interface/ICustomApiMockCreator.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.WebJobs.Extensions.OpenApi.CLI/Service/Interface/ICustomOpenApiCreator.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.WebJobs.Extensions.OpenApi.CLI/Service/Interface/ICustomOpenApiWriter.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nibell I'm still experiencing the exception when I run this app with NO argument.
azfuncopenapi.exe
Could you double check for this?
@Nibell Here's what I ran:
But I get the exception:
Can you reproduce this error on your end? The function app path is completely outside this repo. |
@justinyoo I can reproduce the error (Microsoft.Azure.WebJobs version 3.0.31 is missing). There is a stray package reference in the CLI's csproj (
after that. It looks like some dependencies are not loaded into memory. I don't think it is a good idea to add those missing items as package as it tightly couples the CLI tool with the exact versions used by the function app of which the open api docs are generated. I've done some additional testing on this PR, and found that it currently only supports out-of-process functions. Adding support for in-process functions is quite easy, but this assembly error is quite the challenge. The code loads all the assemblies from the function app it analyzes, but somehow Microsoft.Azure.WebJobs (and a few extension assemblies) cannot be loaded even though the bin folder of the function app has the correct dll. By adding all the missing assemblies as nuget package the problem goes away, but then those assembly versions are pinned. |
@ThomasBleijendaal |
As the PR, #489, has been merged, you can generate the OpenAPI doc on-the-fly, within the GitHub Actions workflow. |
I think it is really a pitty that this PR has been closed. We would definitly use it, the on the fly generation with the script starting the function app and downloading the swagger.json really feels cumbersome. @justinyoo could you consider re-opening this and make it only support out-of-proc functions? As with the new azure function roadmap the webjobs functions are not supported in the future anyway. |
Changes proposed in this pull request:
Have not added build to generate console app, but added support for win, linux and mac os
Resolves #303, #305
Ready for review @justinyoo