How to use OpenAPI files with GitSync
This guide explains how to use OpenAPI spec files with GitSync
Last updated
This guide explains how to use OpenAPI spec files with GitSync
Last updated
Steps (Assuming you write your documentation in GitHub/GitLab):
Configure a space with GitSync.
In the root of your GitHub repository, or in the directory you configured in GitSync, upload your OpenAPI spec file. For the purposes of this guide, we are using a file called sample.yaml
Create a page in your repository, say Page.md, where you want your OpenAPI documentation to be displayed
In the Page.md file, create blocks like the following. Here, sample.yaml is the name of your OpenAPI spec file, the value of path is the endpoint you want to create the block out of, and the value of method is the method you want to create the block out of. Commit your changes.
After the sync with GitBook succeeds, you will see a block that looks like the following in GitBook
You can create such swagger blocks in your file for every path and method you want to document in GitBook.
Steps (Assuming you write your documentation in GitBook):
In the Space and in the page you want to add your OpenAPI operations, open up the command mode in GitBook by pressing forward slash ('/') from within the GitBook app.
Search for OpenAPI in the search window and select OpenAPI.
Select the file you want to upload, and select all the API operations you want to import, and click on Insert Blocks.
The chosen API operations will be imported in GitBook, and if you have GitSync enabled on the space, swagger
blocks will be exported to GitHub/GitLab, representing the operations you have imported.