How to Deploy an OpenAPI Documentation on Netlify
Scenario
- There is an API definition file
open-api-swagger.json
in a private repositoryproduction/api
and I have no write access to it. - I want to deploy a preview website of the
open-api-swagger.json
:- test some Redoc configuration in my repository
Oreoxmt/preview-api
- build the
open-api-swagger.json
specification file into an HTML fileindex.html
usingredoc-cli build
- deploy it on Netlify or other services
- test some Redoc configuration in my repository
Step 1. Import my repository to Netlify
信息
For more details, refer to Import from an existing repository.
-
Log in to Netlify.
-
In the Team overview page, click Add new site and select Import an existing project.
-
Connect to Git provider using the GitHub option and select the
Oreoxmt/preview-api
repository. -
Select Deploy site.
Step 2. Get the private repository content using GitHub API
To get the repository content of the open-api-swagger.json
in the production/api
repository, you can use the GitHub API. For more details, refer to Get repository content.