Generate Elixir API from Swagger / OpenAPI 3.0

Hi all. I’ve seen plenty of information about generating Swagger docs from a pre-existing Phoenix API. Has anyone come across a tool that has the ability to generate a Phoenix API from a Swagger / OpenAPI 3.0 specification? I’ve had a look at Swagger’s Codegen tool but it doesn’t support building server stubs for Elixir. Thank you :slight_smile:

I’ve done quite a lot of research in this area - to the best of my knowledge no such tool exists. It would be very useful for migrating an implementation written in JavaScript, Scala, Python or whatever to Elixir.

Strikes me it wouldn’t be the hardest thing in the world to write. Parse openapi definition, generate the structs and stubs required by openapispex then fill in the blanks. @moxley might have some thoughts

1 Like

Thanks @bryanhuntesl. I did think there wasn’t anything around, but thought it was worth posing the question.

I did some experiments around this kind of work a couple years ago, but didn’t get very far with it. The focus was on generating clients, and server stubs were an eventual goal.

2 Likes