Skip to content

Commit 5f6bea9

Browse files
authored
Merge pull request #1444 from gofiber/codex/2025-10-31-13-04-48
2 parents cf55182 + 6943d26 commit 5f6bea9

21 files changed

+1100
-30
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,23 @@ jobs:
4242
uses: dorny/paths-filter@v3
4343
with:
4444
filters: ${{ steps.filter-setup.outputs.filters }}
45+
46+
- name: Set packages
47+
id: set-packages
48+
run: |
49+
# If this is a push to master or main, build a JSON array of all packages.
50+
# Otherwise, use the filtered list of changed packages.
51+
if [[ "${{ github.event_name }}" == "push" ]]; then
52+
packages=$(find v3 -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | sort | awk 'BEGIN{first=1; printf "["} {if(!first) printf ","; printf "\"%s\"", $0; first=0} END{printf "]"}')
53+
else
54+
packages='${{ steps.filter.outputs.changes }}'
55+
fi
56+
echo "packages<<EOF" >> $GITHUB_OUTPUT
57+
echo "$packages" >> $GITHUB_OUTPUT
58+
echo "EOF" >> $GITHUB_OUTPUT
59+
shell: bash
4560
outputs:
46-
packages: ${{ steps.filter.outputs.changes || '[]' }}
61+
packages: ${{ steps.set-packages.outputs.packages }}
4762

4863
lint:
4964
needs: changes
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Test swaggerui"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
paths:
9+
- 'v3/swaggerui/**/*.go'
10+
- 'v3/swaggerui/go.mod'
11+
- 'v3/swaggerui/go.sum'
12+
pull_request:
13+
paths:
14+
- 'v3/swaggerui/**/*.go'
15+
- 'v3/swaggerui/go.mod'
16+
- 'v3/swaggerui/go.sum'
17+
18+
jobs:
19+
Tests:
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
go-version:
24+
- 1.25.x
25+
steps:
26+
- name: Fetch Repository
27+
uses: actions/checkout@v5
28+
- name: Install Go
29+
uses: actions/setup-go@v5
30+
with:
31+
go-version: '${{ matrix.go-version }}'
32+
- name: Run Test
33+
working-directory: ./v3/swaggerui
34+
run: go test -v -race ./...

.github/workflows/test-swagger.yml renamed to .github/workflows/test-swaggo.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
name: "Test swagger"
1+
name: "Test swaggo"
22

33
on:
44
push:
55
branches:
66
- master
77
- main
88
paths:
9-
- 'v3/swagger/**/*.go'
10-
- 'v3/swagger/go.mod'
9+
- 'v3/swaggo/**/*.go'
10+
- 'v3/swaggo/go.mod'
11+
- 'v3/swaggo/go.sum'
1112
pull_request:
1213
paths:
13-
- 'v3/swagger/**/*.go'
14-
- 'v3/swagger/go.mod'
14+
- 'v3/swaggo/**/*.go'
15+
- 'v3/swaggo/go.mod'
16+
- 'v3/swaggo/go.sum'
1517

1618
jobs:
1719
Tests:
@@ -28,5 +30,5 @@ jobs:
2830
with:
2931
go-version: '${{ matrix.go-version }}'
3032
- name: Run Test
31-
working-directory: ./v3/swagger
33+
working-directory: ./v3/swaggo
3234
run: go test -v -race ./...

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ Repository for third party middlewares and service implementations, with depende
3737
* [otel (opentelemetry)](./v3/otel/README.md) <a href="https://github.com/gofiber/contrib/actions?query=workflow%3A%22Test+otel%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/contrib/test-otel.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" alt="otel workflow status" /> </a>
3838
* [paseto](./v3/paseto/README.md) <a href="https://github.com/gofiber/contrib/actions?query=workflow%3A%22Test+paseto%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/contrib/test-paseto.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" alt="paseto workflow status" /> </a>
3939
* [socket.io](./v3/socketio/README.md) <a href="https://github.com/gofiber/contrib/actions?query=workflow%3A%22Test+socketio%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/contrib/test-socketio.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" alt="socket.io workflow status" /> </a>
40-
* [swagger](./v3/swagger/README.md) <a href="https://github.com/gofiber/contrib/actions?query=workflow%3A%22Test+swagger%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/contrib/test-swagger.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" alt="swagger workflow status" /> </a>
40+
* [swaggo](./v3/swaggo/README.md) _(formerly `swagger`)_ <a href="https://github.com/gofiber/contrib/actions?query=workflow%3A%22Test+swaggo%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/contrib/test-swaggo.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" alt="swaggo workflow status" /> </a>
41+
* [swaggerui](./v3/swaggerui/README.md) <a href="https://github.com/gofiber/contrib/actions?query=workflow%3A%22Test+swaggerui%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/contrib/test-swaggerui.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" alt="swaggerui workflow status" /> </a>
4142
* [websocket](./v3/websocket/README.md) <a href="https://github.com/gofiber/contrib/actions?query=workflow%3A%22Test+websocket%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/contrib/test-websocket.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" alt="websocket workflow status" /> </a>
4243

4344
## 🥡 Service Implementations

go.work

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ use (
1515
./v3/paseto
1616
./v3/sentry
1717
./v3/socketio
18-
./v3/swagger
18+
./v3/swaggo
19+
./v3/swaggerui
1920
./v3/testcontainers
2021
./v3/websocket
2122
./v3/zap

v3/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ Repository for third party middlewares and service implementations, with depende
3535
* [otel (opentelemetry)](./otel/README.md) <a href="https://github.com/gofiber/contrib/actions?query=workflow%3A%22Test+otel%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/contrib/test-otel.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" alt="otel workflow status" /> </a>
3636
* [paseto](./paseto/README.md) <a href="https://github.com/gofiber/contrib/actions?query=workflow%3A%22Test+paseto%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/contrib/test-paseto.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" alt="paseto workflow status" /> </a>
3737
* [socket.io](./socketio/README.md) <a href="https://github.com/gofiber/contrib/actions?query=workflow%3A%22Test+socketio%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/contrib/test-socketio.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" alt="socket.io workflow status" /> </a>
38-
* [swagger](./swagger/README.md) <a href="https://github.com/gofiber/contrib/actions?query=workflow%3A%22Test+swagger%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/contrib/test-swagger.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" alt="swagger workflow status" /> </a>
38+
* [swaggo](./swaggo/README.md) _(formerly `swagger`)_ <a href="https://github.com/gofiber/contrib/actions?query=workflow%3A%22Test+swaggo%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/contrib/test-swaggo.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" alt="swaggo workflow status" /> </a>
39+
* [swaggerui](./swaggerui/README.md) <a href="https://github.com/gofiber/contrib/actions?query=workflow%3A%22Test+swaggerui%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/contrib/test-swaggerui.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" alt="swaggerui workflow status" /> </a>
3940
* [websocket](./websocket/README.md) <a href="https://github.com/gofiber/contrib/actions?query=workflow%3A%22Test+websocket%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/contrib/test-websocket.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" alt="websocket workflow status" /> </a>
4041

4142
## 🥡 Service Implementations

v3/swagger/README.md renamed to v3/swaggerui/README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
2-
id: swagger
3-
title: Swagger
2+
id: swaggerui
3+
title: Swagger UI Middleware
44
---
55

6-
# Swagger
6+
# Swagger UI Middleware
77

8-
![Release](https://img.shields.io/github/v/tag/gofiber/contrib?filter=swagger*)
8+
![Release](https://img.shields.io/github/v/tag/gofiber/contrib?filter=swaggerui*)
99
[![Discord](https://img.shields.io/discord/704680098577514527?style=flat&label=%F0%9F%92%AC%20discord&color=00ACD7)](https://gofiber.io/discord)
10-
![Test](https://github.com/gofiber/contrib/workflows/Test%20swagger/badge.svg)
10+
![Test](https://github.com/gofiber/contrib/workflows/Test%20swaggerui/badge.svg)
1111

12-
Swagger middleware for [Fiber](https://github.com/gofiber/fiber). The middleware handles Swagger UI.
12+
Swagger UI middleware for [Fiber](https://github.com/gofiber/fiber). This handler serves pre-generated Swagger/OpenAPI specs via the swagger-ui package.
1313

1414

1515
**Compatible with Fiber v3.**
@@ -27,64 +27,64 @@ We only support the latest two versions of Go. Visit [https://go.dev/doc/devel/r
2727

2828
### Signatures
2929
```go
30-
func New(config ...swagger.Config) fiber.Handler
30+
func New(config ...swaggerui.Config) fiber.Handler
3131
```
3232

3333
### Installation
3434
Swagger is tested on the latests [Go versions](https://golang.org/dl/) with support for modules. So make sure to initialize one first if you didn't do that yet:
3535
```bash
3636
go mod init github.com/<user>/<repo>
3737
```
38-
And then install the swagger middleware:
38+
And then install the Swagger UI middleware:
3939
```bash
40-
go get github.com/gofiber/contrib/v3/swagger
40+
go get github.com/gofiber/contrib/v3/swaggerui
4141
```
4242

4343
### Examples
4444
Import the middleware package
4545
```go
4646
import (
4747
"github.com/gofiber/fiber/v3"
48-
"github.com/gofiber/contrib/v3/swagger"
48+
"github.com/gofiber/contrib/v3/swaggerui"
4949
)
5050
```
5151

5252
Using the default config:
5353
```go
54-
app.Use(swagger.New())
54+
app.Use(swaggerui.New())
5555
```
5656

5757
Using a custom config:
5858
```go
59-
cfg := swagger.Config{
59+
cfg := swaggerui.Config{
6060
BasePath: "/",
6161
FilePath: "./docs/swagger.json",
6262
Path: "swagger",
6363
Title: "Swagger API Docs",
6464
}
6565

66-
app.Use(swagger.New(cfg))
66+
app.Use(swaggerui.New(cfg))
6767
```
6868

6969
Use program data for Swagger content:
7070
```go
71-
cfg := swagger.Config{
71+
cfg := swaggerui.Config{
7272
BasePath: "/",
7373
FilePath: "./docs/swagger.json",
7474
FileContent: mySwaggerByteSlice,
7575
Path: "swagger",
7676
Title: "Swagger API Docs",
7777
}
7878

79-
app.Use(swagger.New(cfg))
79+
app.Use(swaggerui.New(cfg))
8080
```
8181

8282
Using multiple instances of Swagger:
8383
```go
8484
// Create Swagger middleware for v1
8585
//
8686
// Swagger will be available at: /api/v1/docs
87-
app.Use(swagger.New(swagger.Config{
87+
app.Use(swaggerui.New(swaggerui.Config{
8888
BasePath: "/api/v1/",
8989
FilePath: "./docs/v1/swagger.json",
9090
Path: "docs",
@@ -93,7 +93,7 @@ app.Use(swagger.New(swagger.Config{
9393
// Create Swagger middleware for v2
9494
//
9595
// Swagger will be available at: /api/v2/docs
96-
app.Use(swagger.New(swagger.Config{
96+
app.Use(swaggerui.New(swaggerui.Config{
9797
BasePath: "/api/v2/",
9898
FilePath: "./docs/v2/swagger.json",
9999
Path: "docs",

v3/swagger/go.mod renamed to v3/swaggerui/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/gofiber/contrib/v3/swagger
1+
module github.com/gofiber/contrib/v3/swaggerui
22

33
go 1.25.0
44

File renamed without changes.

v3/swagger/swagger.go renamed to v3/swaggerui/swagger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package swagger
1+
package swaggerui
22

33
import (
44
"encoding/json"

0 commit comments

Comments
 (0)