icyleaf / swagger

Swagger contains a OpenAPI / Swagger universal documentation generator and HTTP server handler.
MIT License
41 stars 10 forks source link

error with post users route in kemal example #25

Closed cesarmarinhorj closed 3 years ago

cesarmarinhorj commented 3 years ago
Showing last frame. Use --error-trace for full trace.

In swagger2.cr:74:19

 74 | Swagger::Action.new("post", "/users", "Create a user",
                      ^--
Error: argument 'responses' already specified

Crystal 0.36.1 [c3a3c1823] (2021-02-02)

LLVM: 10.0.0 Default target: x86_64-unknown-linux-gnu

kemal: git: https://github.com/kemalcr/kemal.git version: 0.27.0

Blacksmoke16 commented 3 years ago

Do you happen to be doing something like this?

Swagger::Action.new("post", "/users", "Create a user", responses: ["R1", "R2"])

Because if so the third argument should be responses, but you're providing it as both a positional and named argument.

~Is easy to reproduce, E.g. https://play.crystal-lang.org/#/r/akks.~

~tl;dr not a bug.~

EDIT: NVM, didn't notice you said it was a bug in the example.

icyleaf commented 3 years ago

@cesarmarinhorj Thanks for feedback, it was a out-of-date example after merged #7