Skip to content

Commit

Permalink
Optimize OpenAPIParam struct field alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
EwenQuim committed Dec 20, 2024
1 parent 6b5df4f commit 2991388
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ type ContextWithBody[B any] interface {
func NewNetHTTPContext[B any](w http.ResponseWriter, r *http.Request, options readOptions) ContextWithBody[B] {
c := &netHttpContext[B]{
CommonContext: internal.CommonContext[B]{
CommonCtx: r.Context(),
UrlValues: r.URL.Query(),
CommonCtx: r.Context(),
UrlValues: r.URL.Query(),
OpenAPIParams: make(map[string]OpenAPIParam),
},
Res: w,
Req: r,
Expand Down
6 changes: 3 additions & 3 deletions internal/common_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ type OpenAPIParam struct {
Name string
Description string

Required bool
Nullable bool

// Default value for the parameter.
// Type is checked at start-time.
Default any
Expand All @@ -30,6 +27,9 @@ type OpenAPIParam struct {
// Only used for response parameters.
// If empty, it is required for 200 status codes.
StatusCodes []int

Required bool
Nullable bool
}

// Base context shared by all adaptors (net/http, gin, echo, etc...)
Expand Down

0 comments on commit 2991388

Please # to comment.