Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/esurdam/go-swagger-ui
Golang package which provides http Handlers to serve the swagger ui
https://github.com/esurdam/go-swagger-ui
Last synced: 14 days ago
JSON representation
Golang package which provides http Handlers to serve the swagger ui
- Host: GitHub
- URL: https://github.com/esurdam/go-swagger-ui
- Owner: esurdam
- License: mit
- Created: 2021-05-25T01:26:09.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-23T08:49:00.000Z (about 2 years ago)
- Last Synced: 2024-07-31T20:53:19.644Z (3 months ago)
- Language: Shell
- Size: 12.3 MB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - go-swagger-ui - Go library containing precompiled [Swagger UI](https://swagger.io/tools/swagger-ui/) for serving swagger json. (Third-party APIs / Utility/Miscellaneous)
- awesome-go-extra - go-swagger-ui - 05-25T01:26:09Z|2021-06-04T20:38:49Z| (Third-party APIs / Fail injection)
README
go-swagger-ui
============[![Documentation](https://godoc.org/github.com/esurdam/go-swagger-ui?status.svg)](http://godoc.org/github.com/esurdam/go-swagger-ui)
[![Go Report Card](https://goreportcard.com/badge/github.com/esurdam/go-swagger-ui)](https://goreportcard.com/report/github.com/esurdam/go-swagger-ui)
[![test](https://github.com/esurdam/go-swagger-ui/actions/workflows/go.yml/badge.svg)](https://github.com/esurdam/go-swagger-ui/actions/workflows/go.yml)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/esurdam/go-swagger-ui/blob/main/LICENSE)This repo provides go handlers for serving `swagger.json` and the [Swagger UI](https://swagger.io/tools/swagger-ui/).
Commonly used with [grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway) compiled swagger.
## Usage
```go
import (
"github.com/esurdam/go-swagger-ui"
)// Asset represents a AssetFn - compiled bindata swagger file
mux := swaggerui.NewServeMux(Asset, "swagger.json") // add swagger bindata asset// /swagger.json serves json
// /swagger-ui serves the swagger-ui
```With custom root:
```go
import (
"github.com/esurdam/go-swagger-ui"
)// Asset represents a AssetFn - compiled bindata swagger file
mux := swaggerui.NewServeMuxWithRoot(Asset, "swagger.json", "/v1/auth") // add swagger bindata asset// v1/auth/swagger.json serves json
// v1/auth/swagger-ui serves the swagger-ui
```## Updating UI
`swagger` directory contains auto-generated output.
1. Add updated assets to //third_party/swagger-ui
2. Run `make build` which will compile swagger into `swagger/bindata.go`