Re: [go-nuts] Re: go-swagger dynamic API creation

2017-03-28 Thread Kevin Conway
Having used go-swagger (https://github.com/go-swagger/go-swagger) at one
point, I'd say that these YAML generators are possibly useful for
generating documentation from your code. One pain point of the
documentation generators, though, is that most require that I create and
maintain code objects exclusively for the benefit of doc generation. At
that point, I'd rather maintain docs than unused code objects. That's a
personal preference, though.

Now, if you're doing any amount of contract negotiation with consumers,
attempting to implement an API contract, intending to perform any amount of
contract testing, or are targeting any form of contract driven development
then these generator tools are a complete inversion of the model you want.
If any of the previous statements are true then you should consider finding
code generators that consume swagger/OpenAPI documents and generate code
skeletons to fill in rather than YAML generators that leverage your code.

On Mon, Mar 27, 2017 at 2:01 PM Matt Ho  wrote:

> Before writing github.com/savaki/swag, I gave goswagger a try.  I think
> goswagger is a fantastic library with lots of useful features.  However,
> for my own use, I found things like:
>
> var findTodos = runtime.OperationHandlerFunc(func(params interface{}) 
> (interface{}, error) {
> log.Println("received 'findTodos'")
> log.Printf("%#v\n", params)
>
> return items, nil})
>
>
> a little cumbersome.  I also wanted to be able to use automatic code
> reload tools like https://github.com/codegangsta/gin and code generation
> made that a little more problematic.
>
> Hence was born:
>
> https://github.com/savaki/swag
>
>
> M
>
> On Monday, March 27, 2017 at 11:39:48 AM UTC-7, Johann Höchtl wrote:
>
> The last time I used it swagger was called swagger.
>
> Lots has changed since it's OpenAPI. A huge framework evolved around it
> https://goswagger.io/
>
> I really like the approach of defining the API entirely dynamically in
> code (and announcements like
> https://groups.google.com/forum/#!topic/golang-nuts/3ebgsgF6W2c, nice!) .
> Unless I misunderstand goswagger.io, nothing prevents the drifting apart
> of the generated code from the YML - api spec.
>
> There is also an example to dynamically generate the swagger spec using
> goswagger.io
> https://goswagger.io/tutorial/dynamic.html
> and I wonder if there is experience using that. Especially is it in
> feature parity with the go generate approach of  goswagger.io?
>
> Thank you!
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: go-swagger dynamic API creation

2017-03-27 Thread Matt Ho
Before writing github.com/savaki/swag, I gave goswagger a try.  I think 
goswagger is a fantastic library with lots of useful features.  However, 
for my own use, I found things like:

var findTodos = runtime.OperationHandlerFunc(func(params interface{}) 
(interface{}, error) {
log.Println("received 'findTodos'")
log.Printf("%#v\n", params)

return items, nil})


a little cumbersome.  I also wanted to be able to use automatic code reload 
tools like https://github.com/codegangsta/gin and code generation made that 
a little more problematic.

Hence was born:

https://github.com/savaki/swag


M

On Monday, March 27, 2017 at 11:39:48 AM UTC-7, Johann Höchtl wrote:
>
> The last time I used it swagger was called swagger.
>
> Lots has changed since it's OpenAPI. A huge framework evolved around it 
> https://goswagger.io/
>
> I really like the approach of defining the API entirely dynamically in 
> code (and announcements like 
> https://groups.google.com/forum/#!topic/golang-nuts/3ebgsgF6W2c, nice!) . 
> Unless I misunderstand goswagger.io, nothing prevents the drifting apart 
> of the generated code from the YML - api spec.
>
> There is also an example to dynamically generate the swagger spec using 
> goswagger.io
> https://goswagger.io/tutorial/dynamic.html
> and I wonder if there is experience using that. Especially is it in 
> feature parity with the go generate approach of  goswagger.io?
>
> Thank you!
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.