wI2L / fizz

:lemon: Gin wrapper with OpenAPI 3 spec generation
https://pkg.go.dev/github.com/wI2L/fizz
MIT License
214 stars 52 forks source link

Add InputModel OperationOption #18

Closed FabienM closed 6 years ago

FabienM commented 6 years ago

InputModel overrides the binding model of an operation, allowing usage of generic handlers.

type testInputModel struct {
    PathParam1 string `path:"a"`
    PathParam2 int    `path:"b"`
    QueryParam string `query:"q"`
}

fizz.GET("/test/:a/:b", []OperationOption{
        ID("GetTest2"),
        InputModel(&testInputModel{}),
    },
    tonic.Handler(func(c *gin.Context) error {
        return nil
    }, 200)
)
codecov[bot] commented 6 years ago

Codecov Report

Merging #18 into master will increase coverage by 0.02%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #18      +/-   ##
==========================================
+ Coverage   96.97%   96.99%   +0.02%     
==========================================
  Files           7        7              
  Lines         860      866       +6     
==========================================
+ Hits          834      840       +6     
  Misses         14       14              
  Partials       12       12
Impacted Files Coverage Δ
fizz.go 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f4c8521...c85f03e. Read the comment docs.