Skip to content

Commit

Permalink
OpenAPI local server moved to setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignaciojeria committed Dec 4, 2024
1 parent 4a9e39f commit 63a1ae2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 7 additions & 0 deletions serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"net/http"
"reflect"
"time"

"github.com/getkin/kin-openapi/openapi3"
)

// Run starts the server.
Expand Down Expand Up @@ -44,6 +46,11 @@ func (s *Server) setup() error {
if s.corsMiddleware != nil {
s.Server.Handler = s.corsMiddleware(s.Server.Handler)
}

s.OpenApiSpec.Servers = append(s.OpenApiSpec.Servers, &openapi3.Server{
URL: fmt.Sprintf("%s://%s", s.proto(), s.Addr),
Description: "local server",
})
return nil
}

Expand Down
5 changes: 0 additions & 5 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,6 @@ func NewServer(options ...func(*Server)) *Server {
option(s)
}

s.OpenApiSpec.Servers = append(s.OpenApiSpec.Servers, &openapi3.Server{
URL: fmt.Sprintf("%s://%s", s.proto(), s.Addr),
Description: "local server",
})

s.startTime = time.Now()

if s.autoAuth.Enabled {
Expand Down

0 comments on commit 63a1ae2

Please sign in to comment.