Aspnetcore.docs: How to use Microsoft.dotnet-openapi?

Created on 12 Dec 2019  Â·  7Comments  Â·  Source: dotnet/AspNetCore.Docs

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.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

PU Source - Docs.ms

Most helpful comment

@Rick-Anderson This issue is #16158 😅

All 7 comments

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 😅

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AnthonyMastrean picture AnthonyMastrean  Â·  3Comments

madelson picture madelson  Â·  3Comments

Rick-Anderson picture Rick-Anderson  Â·  3Comments

Raghumu picture Raghumu  Â·  3Comments

aaron-bozit picture aaron-bozit  Â·  3Comments