Skip to content

Commit

Permalink
add update script
Browse files Browse the repository at this point in the history
  • Loading branch information
a-kataev committed Nov 13, 2022
1 parent 27ce5ed commit 4d061bf
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
# swagfs

## Swagger-UI

Update dist files in `files/dist/*`

```bash
./swagger-ui-dist.sh 4.15.5
```

## Example

Use `echo`

```golang
package main

import (
"log"

"github.com/a-kataev/swagfs"
"github.com/labstack/echo/v4"
)

func main() {
e := echo.New()

cfg := &swagfs.Config{}
cfg.AddURL("https://petstore.swagger.io/v2/swagger.json", "petstore")
cfg.SetLayout("StandaloneLayout")

e.StaticFS("/*", swagfs.FS(cfg))

if err := e.Start("127.0.0.1:8080"); err != nil {
log.Fatal(err)
}
}
```
15 changes: 15 additions & 0 deletions swagger-ui-dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

version=${1:-4.15.5}

set -x

curl -Ls -o swagger-ui.zip "https://github.com/swagger-api/swagger-ui/archive/refs/tags/v${version}.zip"

unzip -o swagger-ui.zip "swagger-ui-${version}/dist/*.*" -d tmp

rm "tmp/swagger-ui-${version}/dist/swagger-initializer.js"

cp -rf "tmp/swagger-ui-${version}/dist" files/

rm -rf tmp swagger-ui.zip

0 comments on commit 4d061bf

Please sign in to comment.