Is there any workable example that shown the Microsoft.dotnet-openapi's usage?
I totally have no idea how to use Microsoft.dotnet-openapi to generate client code.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
This is what we have. You might want to search other sites.
I really don't understand how to use the tool. I can't find any other useful information either. Is it possible to improve the doc?
Hi,
call this comand dotnet openapi add url -p ./Client.csproj --output-file SomeApi.json http://localhost:5000/swagger/v1/swagger.json
. It will generates SomeApiClient.cs
partial class in the obj
folder from the OpenAPI contract. After that, add an empty SomeApiClient
to your project. Now, you can call API methods with SomeApiClient
.
Here is my example project.
@rafaelldi It do works. Thanks for your example! I'm just thinking the doc should have more relevant context or contains more technical details.
Can you guys re-open this? docs don't seem to explain exactly how to use it, or what it actually does: https://docs.microsoft.com/en-us/aspnet/core/web-api/microsoft.dotnet-openapi?view=aspnetcore-3.1
Very nice though! thanks
Dup of #16158
@Rick-Anderson This issue is #16158 😅
Most helpful comment
@Rick-Anderson This issue is #16158 😅