Skip to content

Commit 1ff72af

Browse files
committed
Fix test and some linter issues
1 parent 1956281 commit 1ff72af

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

examples/stream_output/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func main() {
2424
apiSetExternalDocs(&apiDoc)
2525
apiSetComponents(&apiDoc)
2626

27-
apiDoc.AddRoute(docs.Path{
27+
apiDoc.AddRoute(&docs.Path{
2828
Route: "/users",
2929
HTTPMethod: "POST",
3030
OperationID: "createUser",
@@ -43,7 +43,7 @@ func main() {
4343
},
4444
})
4545

46-
apiDoc.AddRoute(docs.Path{
46+
apiDoc.AddRoute(&docs.Path{
4747
Route: "/users",
4848
HTTPMethod: "GET",
4949
OperationID: "getUser",

routing.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ func (oas *OAS) GetPathByIndex(index int) *Path {
4040
}
4141

4242
// AddRoute is used for add API documentation routes.
43-
func (oas *OAS) AddRoute(path Path) {
44-
oas.Paths = append(oas.Paths, path)
43+
func (oas *OAS) AddRoute(path *Path) {
44+
oas.Paths = append(oas.Paths, *path)
4545
}

routing_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,19 +305,19 @@ func TestOAS_AddRoute(t *testing.T) {
305305
tests := []struct {
306306
name string
307307
oas *OAS
308-
path Path
308+
path *Path
309309
wantPaths Paths
310310
}{
311311
{
312312
name: "success-no-existing-paths",
313313
oas: &OAS{},
314-
path: pathGetUser,
314+
path: &pathGetUser,
315315
wantPaths: Paths{pathGetUser},
316316
},
317317
{
318318
name: "success-existing-paths",
319319
oas: &OAS{Paths: Paths{pathGetUser}},
320-
path: pathCreateUser,
320+
path: &pathCreateUser,
321321
wantPaths: Paths{pathGetUser, pathCreateUser},
322322
},
323323
}

0 commit comments

Comments
 (0)