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:
- Entirely remove the Tesla compile-time configuration, except for the adapter (and I’d probably make it easy to override that at runtime).
- Implement a behaviour and default implementation of request token authorization caching (use an optional
con_cachedependency and detection of same). - Look at other generators to see if unit tests using Mox, Tesla.Mock, or Bypass could be generated.
- Look over the way that OpenAPI Generator allows for the use of external templates (whether you have to provide a complete template set or can override individual templates, etc.) and improve the documentation on how that could be done on a per-project basis for Elixir, particularly documenting the extensions to the template functions that help with Elixir.
- Maybe add some combination template functions that cover common repeated cases (e.g.,
{[#atom}}{{#underscored}}}{{value}}{{/underscored}}{/atom}}could be replaced with{{#underscored_atom}}{{value}}{{/underscored_atom}}or something better. - Maybe switch all the mustache templates for elixir to
<%…%>pairs instead of{{…}}pairs because the latter really confuse things when tuples are involved (see an example of the latter inREADME.md.mustache). - Make sure that the current restrictions that are listed on the Elixir clients are real. IIRC, there’s about 40% of the features of OpenAPI that are considered incompatible with Elixir; IMO that should be < 10%—but probably requires some explicit understanding of what those features should do, as well as coming up with good template implementations, etc.
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. ![]()






















