Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
EwenQuim committed Dec 17, 2024
1 parent a585879 commit cc93ae2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
7 changes: 3 additions & 4 deletions extra/fuegogin/adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,21 @@ func Handle[T, B any](

e.Handle(method, path, func(c *gin.Context) {
context := &ContextWithBody[B]{

ginCtx: c,
}

ans, err := handler(context)
resp, err := handler(context)
if err != nil {
c.Error(err)
return
}

if c.Request.Header.Get("Accept") == "application/xml" {
c.XML(200, ans)
c.XML(200, resp)
return
}

c.JSON(200, ans)
c.JSON(200, resp)
})

route.RegisterOpenAPIOperation(openapi)
Expand Down
6 changes: 0 additions & 6 deletions openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,6 @@ func RegisterOpenAPIOperation[T, B any](openapi *OpenAPI, route Route[T, B]) (*o
}
}

// Names & default description

if route.Operation.OperationID == "" {
route.Operation.OperationID = route.Method + "_" + strings.ReplaceAll(strings.ReplaceAll(route.Path, "{", ":"), "}", "")
}

openapi.Description().AddOperation(route.Path, route.Method, route.Operation)

return route.Operation, nil
Expand Down
2 changes: 1 addition & 1 deletion option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ func TestOptionDescription(t *testing.T) {
option.Middleware(dummyMiddleware), // 7th middleware, should not be included
)

require.Equal(t, "#### Controller: \n\n`github.com/go-fuego/fuego_test.helloWorld`\n\n#### Middlewares:\n\n- `github.com/go-fuego/fuego_test.dummyMiddleware`\n- `github.com/go-fuego/fuego_test.dummyMiddleware`\n- `github.com/go-fuego/fuego_test.dummyMiddleware`\n- `github.com/go-fuego/fuego_test.dummyMiddleware`\n- `github.com/go-fuego/fuego_test.dummyMiddleware`\n- more middleware...\n\n---\n\nanother description", route.Operation.Description)
require.Equal(t, "#### Controller: \n\n`github.com/go-fuego/fuego_test.helloWorld`\n\n#### Middlewares:\n\n- `github.com/go-fuego/fuego_test.dummyMiddleware`\n- `github.com/go-fuego/fuego_test.dummyMiddleware`\n- `github.com/go-fuego/fuego_test.dummyMiddleware`\n- `github.com/go-fuego/fuego_test.dummyMiddleware`\n- `github.com/go-fuego/fuego_test.dummyMiddleware`\n- more middleware\n\n---\n\nanother description", route.Operation.Description)
})
}

Expand Down

0 comments on commit cc93ae2

Please sign in to comment.