Can Swashbuckle connect to SwaggerHub?

Viewed 196

(New to Api documentation)

I am somewhat confused with the difference between SwaggerUI and SwaggerHub.

Currently I have a C# Asp.net Web API code and Swashbuckle.AspNetCore is reading the code and the API is being documented on Swagger UI. I have adopted a code first approach as everything is already coded. However, I would like to have my API documented in SwaggerHub.

I have currently not found any solutions of this online.

Is this possible and how do I go about doing it?

1 Answers

This is extremely easy to accomplish.

Once your document is generated by Swashbuckle, all that's needed for you to do is "push" the documentation to your instance of SwaggerHub. You can do this using one of two tools:

The create or update command from the SwaggerHub CLI: https://github.com/SmartBear/swaggerhub-cli

The POST /apis/{owner}/{api} endpoint from SwaggerHub's registry API : https://app.swaggerhub.com/apis-docs/swagger-hub/registry-api/1.0.62#/APIs/saveDefinition

With both of these tools you can programmatically send documentation from your build environment to SwaggerHub (as well as a lot of other cools things!).

Related