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

Fizz does not work with generic structs #80

Open LorenzoWF opened 2 years ago

LorenzoWF commented 2 years ago

With the 1.18 version of Go, we can have this:

type MyStruct[T ObjA | ObjB] struct {
    Result T `json:"result"`
}

But unfortunately the fizz cannot generate the spec for this :(

wI2L commented 2 years ago

Indeed, the reflect part of the code has not been updated to work with generic code introduced by Go1.18. I might work on it at some point (really depends if there's a need for projects at OVH), but otherwise I would be happy to accept contributions.

LorenzoWF commented 2 years ago

Ok, probably i will be send a PR or a draft ideia here 👍 .

wI2L commented 2 years ago

Changes made to fizz should be made to tonic first, since the former depends on the latter to work. I'd need to document myself on the reflect package changes introduced by the addition of generics to get a better understanding of how it can be done.

nadilas commented 1 year ago

I'd like to help out. @LorenzoWF did you manage to get to a draft?