oapi-codegen
oapi-codegen copied to clipboard
Feat: register multiple specs
Hello thanks for building and supporting this incredibly useful software :hugs:
I'm able to generate OAPI3 specs into a server for a single spec. However, when I add 2+ specs and try to register their routes, only the first pack of routes gets registered. I tried this for Echo and Iris.
// trying to register servers foo and bar
app := iris.Default()
apiv1.RegisterHandlers(app, foo) <--- these routes are registered
apiv1.RegisterHandlers(app, bar) <--- these routes are skipped
This approach works well for GRPC, when you can separately register multiple services with own API for a common GRPC server
UPD: I was able to work around this by implementing a partial route registration with Iris:
// *** Foo API
fooAPI := app.Party("/v1/foo")
fooAPI.Post("/", fooRest.Create)
// *** Bar API
barAPI := app.Party("/v1/bar")
barAPI.Post("/", barRest.Create)