metosin / compojure-api

Sweet web apis with Compojure & Swagger
http://metosin.github.io/compojure-api/doc/
Eclipse Public License 1.0
1.11k stars 149 forks source link

OpenAPI? #447

Open luposlip opened 3 years ago

luposlip commented 3 years ago

Library Version(s)

[metosin/compojure-api "2.0.0-alpha31"]
[metosin/spec-tools "0.10.4"]

Problem

I can't seem to find a standard way to generate OpenAPI specification from my api. I have the swagger spec and swagger UI working just fine (and it rocks!). But a team I'm working with needs OpenAPI specs (and possibly also UI).

It'd be cool if the :swagger etc. could be replaced by :openapi in this snippet of a snippet:

(api
   {:swagger
    {:ui "/"
     :spec "/swagger.json"
     :data {...

Do you have an example project where you've implemented this, or can you give me some hints on how - if possible - to achieve this?

Thanks.

luposlip commented 3 years ago

Anyone? :wink:

aphsa commented 3 years ago

How to upvote this request? +1:

rrudakov commented 3 years ago

Hello, if it's still relevant I've created an example project with generation OpenAPI3 documentation with compojure-api here. It was very quick and needs some cleanup, file uploads don't work so far (I'm going to fix it).

I'd like to open PR to this repo to add OpenAPI3 docs generation out of the box, but I need to figure out how to do it better way. Probably support of swagger2 generation should be dropped in this case.

luposlip commented 3 years ago

Really cool, thanks so far @rrudakov !

rrudakov commented 3 years ago

@luposlip I've fixed file uploads in my example.