metosin / reitit

A fast data-driven routing library for Clojure/Script

Home Page:https://cljdoc.org/d/metosin/reitit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for descriptions in OpenAPI query parameters

MarcGn opened this issue · comments

commented

Hi I'm unable to add a description to the query parameters which will show up like this on the swagger UI:

image

Using schema-tools schema, I can add a description like so:

(s/defschema QuerySchema
 {:start-time (st/schema s/Num {:openapi/description "Description here"})
  :end-time (st/schema s/Num {:openapi/description "Description here"})}})

But this will generate an output where the description is a property under :schema and the top level description is still "" (so nothing shows in the UI):

{
          "name" : "start-time",
          "in" : "query",
          "description" : "",
          "required" : true,
          "schema" : {
            "type" : "number",
            "format" : "double",
            "description" : "Description here"
          }
 }

The same thing happens with Malli. Pretty sure this block is the root cause: https://github.com/metosin/reitit/blob/master/modules/reitit-malli/src/reitit/coercion/malli.cljc#L151-L155

I'm looking into this now.

fix for malli in PR #624

schema needs fixes on in schema-tools

spec seems to work currently. I've added a test for it in #624

#625 fixes this for spec