Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Gorilla generation #585

Merged
merged 2 commits into from May 26, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -255,6 +255,9 @@ func SetupHandler() {
http.Handle("/", Handler(&myApi))
}
```

Alternatively, [Gorilla](https://github.com/gorilla/mux) is also 100% compatible with `net/http` and can be generated with `-generate gorilla`.

</summary></details>

#### Additional Properties in type definitions
Expand Down
4 changes: 3 additions & 1 deletion cmd/oapi-codegen/oapi-codegen.go
Expand Up @@ -86,7 +86,7 @@ func main() {
// All flags below are deprecated, and will be removed in a future release. Please do not
// update their behavior.
flag.StringVar(&flagGenerate, "generate", "types,client,server,spec",
`Comma-separated list of code to generate; valid options: "types", "client", "chi-server", "server", "gin", "spec", "skip-fmt", "skip-prune"`)
`Comma-separated list of code to generate; valid options: "types", "client", "chi-server", "server", "gin", "gorilla", "spec", "skip-fmt", "skip-prune"`)
flag.StringVar(&flagIncludeTags, "include-tags", "", "Only include operations with the given tags. Comma-separated list of tags.")
flag.StringVar(&flagExcludeTags, "exclude-tags", "", "Exclude operations that are tagged with the given tags. Comma-separated list of tags.")
flag.StringVar(&flagTemplatesDir, "templates", "", "Path to directory containing user templates")
Expand Down Expand Up @@ -321,6 +321,8 @@ func newConfigFromOldConfig(c oldConfiguration) configuration {
opts.Generate.EchoServer = true
case "gin":
opts.Generate.GinServer = true
case "gorilla":
opts.Generate.GorillaServer = true
case "types":
opts.Generate.Models = true
case "spec":
Expand Down
6 changes: 6 additions & 0 deletions examples/petstore-expanded/gorilla/api/cfg.yaml
@@ -0,0 +1,6 @@
package: api
generate:
gorilla-server: true
models: true
embedded-spec: true
output: petstore.gen.go