Hey folks! I’m trying to find a library to generate swagger/openapi specification based on elixir code (typed structs or type definitions). Unfortunately I can’t find anything…
I’m new in elixir and phoenix. I want to generate swagger/openapi describing REST API. This should be a common problem, I’m wondering how others tackle it.
if you’re willing to wait a few weeks, my company is releasing an open-source framework for OpenAPI that takes a document-centric view (it uses the OpenAPI schema as a central source of truth and there are no additional DSLs to learn).
We just pushed it to a private repo for one release worth of validating in prod before fully open sourcing it.
Note that this is not exactly what you are working for, it’s more like how Go and C# developers do it… But I’m convinced that going from the schema to code is the “correct way” of doing things, instead of going from code (comments, annotations, etc) to schema.
@ityonemo I agree that the schema to code approach is better, because documentation/schema becomes a single source of truth for both back-end and front-end! I would love to see your solution! Feel free to publish a link to your library here, or DM me https://www.linkedin.com/in/ddoronin/
I’ll post it here in addition to a general announcement on the board.
@ityonemo any updates about your OpenAPI framework??
As far as I’m concerned it’s ready, but my now former boss has to approve some licensing things, I think. It’s in his best interest to do it, because I imagine he’ll get free support on the library if he open-sources it .
I’m also really hyped for something like this to be open sourced and would love to work on it !
Any news @ityonemo ?
So I kept trying to contact my former boss but he said nothing, so I’ll have to rewrite it. There will be some news on this front soon.
@ityonemo any news one it?
Let me know if you need help with testing it.
the JsonSchema parsing major refactor is done, though I’m doing one more re-refactor presently =D, and the OpenAPI compiler is in progress here: GitHub - E-xyza/Apical: OpenAPI Compiler for Elixir
The OpenAPI parts are going MUCH smoother than I expected, I’m currently working on marshalling query params, which is one of the harder ones to get correct, the general strategy should apply to headers, cookies, body params, etc.