Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/petstore-expanded/strict/api/petstore-server.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions internal/test/strict-server/chi/server.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/codegen/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,8 @@ func GenerateGorillaServer(t *template.Template, operations []OperationDefinitio

func GenerateStrictServer(t *template.Template, operations []OperationDefinition, opts Configuration) (string, error) {
templates := []string{"strict/strict-interface.tmpl"}
if opts.Generate.ChiServer {
templates = append(templates, "strict/strict-chi.tmpl")
if opts.Generate.ChiServer || opts.Generate.GorillaServer {
templates = append(templates, "strict/strict-http.tmpl")
}
if opts.Generate.EchoServer {
templates = append(templates, "strict/strict-echo.tmpl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ type StrictHandlerFunc func(ctx context.Context, w http.ResponseWriter, r *http.

type StrictMiddlewareFunc func(f StrictHandlerFunc, operationID string) StrictHandlerFunc

type StrictChiServerOptions struct {
type StrictHTTPServerOptions struct {
RequestErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
ResponseErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface {
return &strictHandler{ssi: ssi, middlewares: middlewares, options: StrictChiServerOptions {
return &strictHandler{ssi: ssi, middlewares: middlewares, options: StrictHTTPServerOptions {
RequestErrorHandlerFunc: func(w http.ResponseWriter, r *http.Request, err error) {
http.Error(w, err.Error(), http.StatusBadRequest)
},
Expand All @@ -18,14 +18,14 @@ func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareF
}}
}

func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictChiServerOptions) ServerInterface {
func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictHTTPServerOptions) ServerInterface {
return &strictHandler{ssi: ssi, middlewares: middlewares, options: options}
}

type strictHandler struct {
ssi StrictServerInterface
middlewares []StrictMiddlewareFunc
options StrictChiServerOptions
options StrictHTTPServerOptions
}

{{range .}}
Expand Down