Skip to content

Commit

Permalink
Update to Swagger UI v4.5.0 (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
vearutop authored Feb 7, 2022
1 parent 575524c commit ce58b06
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ endif
# Add your custom targets here.

SWAGGER_UI_VERSION_V3 := v3.52.5
SWAGGER_UI_VERSION_V4 := v4.1.3
SWAGGER_UI_VERSION_V4 := v4.5.0

## Update assets for Swagger UI v3
update-v3:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ UI [v3.52.4](https://github.com/swagger-api/swagger-ui/releases/tag/v3.52.4).
### V4

Static assets for `v4` are built from Swagger
UI [v4.1.3](https://github.com/swagger-api/swagger-ui/releases/tag/v4.1.3).
UI [v4.5.0](https://github.com/swagger-api/swagger-ui/releases/tag/v4.5.0).

[CDN-based](https://cdnjs.com/libraries/swagger-ui) `v4cdn` uses Swagger
UI [v4.1.3](https://github.com/swagger-api/swagger-ui/releases/tag/v4.1.3).
UI [v4.5.0](https://github.com/swagger-api/swagger-ui/releases/tag/v4.5.0).


## How to use
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/swaggest/swgui
go 1.17

require (
github.com/bool64/dev v0.2.4
github.com/bool64/dev v0.2.5
github.com/shurcooL/httpgzip v0.0.0-20190720172056-320755c1c1b0
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd
github.com/vearutop/statigz v1.1.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
github.com/andybalholm/brotli v1.0.3 h1:fpcw+r1N1h0Poc1F/pHbW40cUm/lMEQslZtCkBQ0UnM=
github.com/andybalholm/brotli v1.0.3/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/bool64/dev v0.1.41/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU=
github.com/bool64/dev v0.2.4 h1:eXhpZE+A5Ka2Yjnbm+gQmwj3hgxnYklyyZz5cKtgHiM=
github.com/bool64/dev v0.2.4/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU=
github.com/bool64/dev v0.2.5 h1:H0bylghwcjDBBhEwSFTjArEO9Dr8cCaB54QSOF7esOA=
github.com/bool64/dev v0.2.5/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
9 changes: 8 additions & 1 deletion v3/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@
package v3

import (
"net/http"

"github.com/swaggest/swgui"
"github.com/swaggest/swgui/internal"
)

// Handler handles swagger UI request.
type Handler = internal.Handler

// NewHandler returns a HTTP handler for swagger UI.
// New creates HTTP handler for Swagger UI.
func New(title, swaggerJSONPath string, basePath string) http.Handler {
return NewHandler(title, swaggerJSONPath, basePath)
}

// NewHandler creates HTTP handler for Swagger UI.
func NewHandler(title, swaggerJSONPath string, basePath string) *Handler {
return NewHandlerWithConfig(swgui.Config{
Title: title,
Expand Down
11 changes: 9 additions & 2 deletions v3cdn/handler.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
package v3cdn

import (
"net/http"

"github.com/swaggest/swgui"
"github.com/swaggest/swgui/internal"
)

// Handler handle swagger UI request.
type Handler = internal.Handler

// NewHandler returns a HTTP handler for swagger UI.
// New creates HTTP handler for Swagger UI.
func New(title, swaggerJSONPath string, basePath string) http.Handler {
return NewHandler(title, swaggerJSONPath, basePath)
}

// NewHandler creates HTTP handler for Swagger UI.
func NewHandler(title, swaggerJSONPath string, basePath string) *Handler {
return NewHandlerWithConfig(swgui.Config{
Title: title,
Expand All @@ -17,7 +24,7 @@ func NewHandler(title, swaggerJSONPath string, basePath string) *Handler {
})
}

// NewHandlerWithConfig returns a HTTP handler for swagger UI.
// NewHandlerWithConfig creates HTTP handler for Swagger UI.
func NewHandlerWithConfig(config swgui.Config) *Handler {
return internal.NewHandlerWithConfig(config, AssetsBase, FaviconBase, nil)
}
11 changes: 9 additions & 2 deletions v3emb/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@
package v3emb

import (
"net/http"

"github.com/swaggest/swgui"
"github.com/swaggest/swgui/internal"
)

// Handler handles swagger UI request.
type Handler = internal.Handler

// NewHandler returns a HTTP handler for swagger UI.
// New creates HTTP handler for Swagger UI.
func New(title, swaggerJSONPath string, basePath string) http.Handler {
return NewHandler(title, swaggerJSONPath, basePath)
}

// NewHandler creates HTTP handler for Swagger UI.
func NewHandler(title, swaggerJSONPath string, basePath string) *Handler {
return NewHandlerWithConfig(swgui.Config{
Title: title,
Expand All @@ -18,7 +25,7 @@ func NewHandler(title, swaggerJSONPath string, basePath string) *Handler {
})
}

// NewHandlerWithConfig returns a HTTP handler for swagger UI.
// NewHandlerWithConfig creates HTTP handler for Swagger UI.
func NewHandlerWithConfig(config swgui.Config) *Handler {
return internal.NewHandlerWithConfig(config, assetsBase, faviconBase, staticServer)
}
11 changes: 9 additions & 2 deletions v4/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@
package v4

import (
"net/http"

"github.com/swaggest/swgui"
"github.com/swaggest/swgui/internal"
)

// Handler handles swagger UI request.
type Handler = internal.Handler

// NewHandler returns a HTTP handler for swagger UI.
// New creates HTTP handler for Swagger UI.
func New(title, swaggerJSONPath string, basePath string) http.Handler {
return NewHandler(title, swaggerJSONPath, basePath)
}

// NewHandler creates HTTP handler for Swagger UI.
func NewHandler(title, swaggerJSONPath string, basePath string) *Handler {
return NewHandlerWithConfig(swgui.Config{
Title: title,
Expand All @@ -18,7 +25,7 @@ func NewHandler(title, swaggerJSONPath string, basePath string) *Handler {
})
}

// NewHandlerWithConfig returns a HTTP handler for swagger UI.
// NewHandlerWithConfig creates HTTP handler for Swagger UI.
func NewHandlerWithConfig(config swgui.Config) *Handler {
return internal.NewHandlerWithConfig(config, assetsBase, faviconBase, staticServer)
}
30 changes: 15 additions & 15 deletions v4/static.go

Large diffs are not rendered by default.

Binary file modified v4/static/swagger-ui-bundle.js.gz
Binary file not shown.
Binary file modified v4/static/swagger-ui-standalone-preset.js.gz
Binary file not shown.
Binary file modified v4/static/swagger-ui.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion v4cdn/cdn.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package v4cdn

const (
// AssetsBase is a base URL for the assets.
AssetsBase = "https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.1.3/"
AssetsBase = "https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.5.0/"

// FaviconBase is a base URL for favicons.
FaviconBase = "https://petstore.swagger.io/"
Expand Down
11 changes: 9 additions & 2 deletions v4cdn/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@
package v4cdn

import (
"net/http"

"github.com/swaggest/swgui"
"github.com/swaggest/swgui/internal"
)

// Handler handle swagger UI request.
type Handler = internal.Handler

// NewHandler returns a HTTP handler for swagger UI.
// New creates HTTP handler for Swagger UI.
func New(title, swaggerJSONPath string, basePath string) http.Handler {
return NewHandler(title, swaggerJSONPath, basePath)
}

// NewHandler creates HTTP handler for Swagger UI.
func NewHandler(title, swaggerJSONPath string, basePath string) *Handler {
return NewHandlerWithConfig(swgui.Config{
Title: title,
Expand All @@ -18,7 +25,7 @@ func NewHandler(title, swaggerJSONPath string, basePath string) *Handler {
})
}

// NewHandlerWithConfig returns a HTTP handler for swagger UI.
// NewHandlerWithConfig creates HTTP handler for Swagger UI.
func NewHandlerWithConfig(config swgui.Config) *Handler {
return internal.NewHandlerWithConfig(config, AssetsBase, FaviconBase, nil)
}
11 changes: 9 additions & 2 deletions v4emb/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@
package v4emb

import (
"net/http"

"github.com/swaggest/swgui"
"github.com/swaggest/swgui/internal"
)

// Handler handles swagger UI request.
type Handler = internal.Handler

// NewHandler returns a HTTP handler for swagger UI.
// New creates HTTP handler for Swagger UI.
func New(title, swaggerJSONPath string, basePath string) http.Handler {
return NewHandler(title, swaggerJSONPath, basePath)
}

// NewHandler creates HTTP handler for Swagger UI.
func NewHandler(title, swaggerJSONPath string, basePath string) *Handler {
return NewHandlerWithConfig(swgui.Config{
Title: title,
Expand All @@ -18,7 +25,7 @@ func NewHandler(title, swaggerJSONPath string, basePath string) *Handler {
})
}

// NewHandlerWithConfig returns a HTTP handler for swagger UI.
// NewHandlerWithConfig creates HTTP handler for Swagger UI.
func NewHandlerWithConfig(config swgui.Config) *Handler {
return internal.NewHandlerWithConfig(config, assetsBase, faviconBase, staticServer)
}

0 comments on commit ce58b06

Please sign in to comment.