Fork me on GitHub
#reitit
<
2023-10-09
>
Stig Brautaset11:10:03

Is it possible to generate OpenAPI spec from Clojure Spec with reitit? We are already using Clojure Spec and we want to add a documentation UI (OpenAPI/Swagger), and would prefer to not have to manually keep a handcrafted OpenAPI spec in sync with our Clojure specs.

Stig Brautaset11:10:20

I have found reitit-spec, currently trying to see if that will work for me

lispyclouds12:10:47

Not exactly what you’re looking for but can try the other way round: https://github.com/lispyclouds/navi 😆

😄 1
Stig Brautaset14:10:37

We're quite keen on the other direction at the moment, but if that's impossible I might look at OpenAPI -> Spec conversion instead.

Stig Brautaset14:10:59

Saying that, how mature is navi? I haven't looked at the code at all, but my initial reaction is that the version number (0.0.4) is going to make it hard to argue that it's mature enough to use in our production system.

Stig Brautaset16:10:08

As for my original question, it looks like the answer is yes! https://cljdoc.org/d/metosin/reitit/0.6.0/doc/ring/swagger-support 🙂

opqdonut05:10:29

reitit already supports OpenAPI 2 aka Swagger

👍 1
opqdonut05:10:41

Openapi 3.1 support will be the headline for 0.7.0

opqdonut05:10:46

You can already try out the alpha

Stig Brautaset10:10:21

I'm currently looking at version 0.6.0, as there would be resistance to bringing alpha versions into production. I see it's been alpha for a while though, and hope that it 0.7.0 could come out soon 🙂

lispyclouds08:10:48

Saying that, how mature is navi?As you can see its a bit of a niche lib and built primarily by me to allow me to build servers the way I really want to: spec-first and not code; something im quite opinionated about 🙂 having said that, it has seen some usage with some users but not enough id say. the features and stability is based on feature requests and bugs but its not battle tested enough as most servers are the other way round. if you choose to use it, im happy to dedicated some time to it! as for the version, it follows clojure's views about versions not implying stability, the API will be stable. has just one fn as of now: routes-from

👍 1