Connect your GitHub repo to SwaggerHub in 6 simple steps!

November 12, 2021

Blogger Image

Agnel Roysten

Software Engineer

SwaggerHub allows you to store the specification in popular source control management tools.

The following steps will help you integrate your GitHub repo with SwaggerHub in 6 simple steps.

  1. After defining the specification, click on the ‘Integrations’ tab, as shown below.
  2. Click on ‘Add New Integrations’ and select the option for ‘GitHub Sync’ from the dropdown menu.
  3. Type the name of the GitHub-SwaggerHub integration to identify the integration. This will be used later in dealing with the integration using Registry API, which will be discussed in our next blog.
  4. Type the output file name, i.e., the file name of the specification that will be pushed to the repository, and click on ‘Connect to GitHub’.

  5. Enter credentials to log in to GitHub.
  6. You may receive an email to verify the sign-in attempt. Click on the review link in the email and check the SwaggerHub page again. You will see the text field with an increased number of configured values in the Integration configuration prompt box, as shown below.
  7. *poc-petstore is a new repository that has been configured for this API specification (can be selected via the dropdown).

    *The token value will be generated automatically after providing the credentials.

    *Repository owner is the default owner of the configured repository.

  8. Set values for other parameters.
    • Set Branch as apidefinition (if not present, a new branch will be created while executing the integration).
    • Set Sync Type to Basic Sync - if there are no files present in the branch, and Advanced Sync - if files and folders are present.
    • Define the type of code to sync your GitHub repository with and the output folder for the generated code or specification. Here, we have set the type of code as YAML (unresolved) and the output folder as apispec.
    • Click ‘CREATE AND EXECUTE’ and you will be able to view the integration name in the integration list.

    You will be able to see the OAS3.0 specification in the folder apispec, as shown below.

    Congratulations! You have successfully connected your GitHub repo with SwaggerHub.

Join the conversation

What are your thoughts on this blog? Drop us a line below. We’d love to hear from you.

© 2024 Nous Infosystems. All rights reserved.