https://github.com/jefeish/swagger-pages
testing swagger UI with GH Pages
https://github.com/jefeish/swagger-pages
Last synced: 2 months ago
JSON representation
testing swagger UI with GH Pages
- Host: GitHub
- URL: https://github.com/jefeish/swagger-pages
- Owner: jefeish
- Created: 2022-03-15T17:08:39.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-06-25T01:57:38.000Z (11 months ago)
- Last Synced: 2025-02-01T16:27:27.351Z (4 months ago)
- Language: HTML
- Size: 5.61 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[Open the GitHub Rest API Swagger Page](https://jefeish.github.io/swagger-pages/)
Note: Add this code to the GitHub Open API schema to enable Authorization
Ref: Describing Bearer Authentication
Note: Find the "components:" section and add the code
```yaml
security:
- bearerAuth: []
components:
securitySchemes:
bearerAuth: # arbitrary name for the security scheme
type: http
scheme: bearer
bearerFormat: JWT
```
# How to host Swagger API documentation with GitHub Pages
[](https://peterevans.dev/posts/how-to-host-swagger-docs-with-github-pages/)
This repository is a template for using the [Swagger UI](https://github.com/swagger-api/swagger-ui) to dynamically generate beautiful documentation for your API and host it for free with GitHub Pages.
The template will periodically auto-update the Swagger UI dependency and create a pull request. See the [GitHub Actions workflow here](.github/workflows/update-swagger.yml).
The example API specification used by this repository can be seen hosted at [https://peter-evans.github.io/swagger-github-pages](https://peter-evans.github.io/swagger-github-pages/).
## Steps to use this template
1. Click the `Use this template` button above to create a new repository from this template.
2. Go to the settings for your repository at `https://github.com/{github-username}/{repository-name}/settings` and enable GitHub Pages.

3. Browse to the Swagger documentation at `https://{github-username}.github.io/{repository-name}/`.## Steps to manually configure in your own repository
1. Download the latest stable release of the Swagger UI [here](https://github.com/swagger-api/swagger-ui/releases).
2. Extract the contents and copy the "dist" directory to the root of your repository.
3. Move the file "index.html" from the directory "dist" to the root of your repository.
```
mv dist/index.html .
```
4. Copy the YAML specification file for your API to the root of your repository.5. Edit [index.html](index.html) and change the `url` property to reference your local YAML file.
```javascript
const ui = SwaggerUIBundle({
url: "swagger.yaml",
...
```
Then fix any references to files in the "dist" directory.
```html
...
...
...
```
6. Go to the settings for your repository at `https://github.com/{github-username}/{repository-name}/settings` and enable GitHub Pages.
7. Browse to the Swagger documentation at `https://{github-username}.github.io/{repository-name}/`.The example API specification used by this repository can be seen hosted at [https://peter-evans.github.io/swagger-github-pages](https://peter-evans.github.io/swagger-github-pages/).