vipes
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 ![]()
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
bryanhuntesl
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
vipes
Thanks @bryanhuntesl. I did think there wasn’t anything around, but thought it was worth posing the question.
moxley
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.
gmile
For what it’s worth, there’s an Elixir “backend” in the openapi-generator, introduced back in 2017, and still alive – there’s a recent PR open from an early July 2022 by @halostatue)I tried generating Elixir app from a OpenAPI spec provided in openapi-generator’s samples. Generation works. The generated code doesn’t look like Phoenix API though. I didn’t test it further, e.g. running an actual API server to see if it behaves as expected.It’s not exactly an answer to generating a “Phoenix API”-compatible Elixir code, but better than nothing (I guess).On a second view, scratch what I said. It’s a client code generation
Eiamnacken
To give some perspective. It is also difficult to keep this in sync with the openapi spec over time. Also, the generators get old very fast. From my experience from using this in java. We had more trouble with the generator. Instead, we built it manually and programmed unit tests to check that the implementation is in sync with the openapi spec.
And also the spec is quite complex as this is using all features json-schema has to offer.
halostatue
Thanks for the mention. The opened client PR is about to merged, so that is a good thing.
I’d be happy to spend some time talking with someone on how OpenAPI generator could be extended to provide a server generator. There’s a few things noted in the documentation as “not compatible” in Elixir that make no sense to me, but that’s likely resolvable.
Even though the OpenAPI generator is written in one of my least favourite languages (Java), I found the codebase to be eminently approachable and entirely runnable in Docker so that I didn’t have to have a Java development environment set up.
reddy
It looks like the PR still hasn’t been merged, are the clients generated by the current release (not including your PR) usable/production ready or do you think it is better to wait for the PR to be merged before getting started?
halostatue
The PR in question is the second of two, and the first was necessary to make the Elixir clients baseline usable again (certain things had drifted). This PR is more of an improvements PR that makes for better clients (the generated code looks more like what is expected, and requires less change when running
mix format; the current released version will have more drift).There are more changes that I would want to make based on the last several years of using Tesla and Elixir:
con_cachedependency and detection of same).{[#atom}}{{#underscored}}}{{value}}{{/underscored}}{/atom}}could be replaced with{{#underscored_atom}}{{value}}{{/underscored_atom}}or something better.<%…%>pairs instead of{{…}}pairs because the latter really confuse things when tuples are involved (see an example of the latter inREADME.md.mustache).Which is to say that, what’s there is good. The PR makes it even better. There’s a lot more work to be done. I suspect that if I do much more with it, I’ll end up as a reviewer on open Elixir tickets.
ityonemo
I have an impl of this and I’m talking to my former boss to get it open sourced. If I can’t get that, I can provide tips if you want to imply your own.
ityonemo
Update:. The library is on its way. I’m currently refactoring the JSONschema stuff to be easier to debug