-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add impl gen, optional swagger gen, support std http.ServeMux, swagge…
…r json options, go_package supporting
- Loading branch information
Showing
7 changed files
with
541 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package genhandler | ||
|
||
import "github.com/go-openapi/spec" | ||
|
||
type options struct { | ||
ImplPath string | ||
DescPath string | ||
SwaggerDef map[string]*spec.Swagger | ||
Impl bool | ||
Force bool | ||
} | ||
|
||
type Option func(*options) | ||
|
||
// SwaggerDef sets map of spec.Swagger per proto file | ||
func SwaggerDef(swaggerDef map[string]*spec.Swagger) Option { | ||
return func(o *options) { | ||
o.SwaggerDef = swaggerDef | ||
} | ||
} | ||
|
||
// Impl sets Impl flag option (if true implementation will be generated) | ||
func Impl(impl bool) Option { | ||
return func(o *options) { | ||
o.Impl = impl | ||
} | ||
} | ||
|
||
// ImplPath sets path for implementation file | ||
func ImplPath(path string) Option { | ||
return func(o *options) { | ||
o.ImplPath = path | ||
} | ||
} | ||
|
||
// DescPath sets path for description and swagger file | ||
func DescPath(path string) Option { | ||
return func(o *options) { | ||
o.DescPath = path | ||
} | ||
} | ||
|
||
// Force sets force mode for generation implementation | ||
func Force(force bool) Option { | ||
return func(o *options) { | ||
o.Force = force | ||
} | ||
} |
Oops, something went wrong.