swagger-ui does generates error when response contains a schema with registry
mcuervoe-np opened this issue · comments
Thanks for such an amazing library. I use it in all my projects. In my latest, I am using malli extensively, and I found this problem with swagger-ui:
When a route contains a :responses
with a schema that uses a local registry, the swagger-ui produces an error.
For example:
(def local-registry {::total :int})
(def Total (mc/schema [:map {:registry local-registry}
[:total ::total]]))
....
["/plus"
{:get {:summary "plus with malli responses"
:responses {200 {:body Total}}
:handler (fn [_]
{:status 200
:body {:total 2}})}}]
When you open the swagger-ui in the browser, you get this error:
Resolver error at responses.200.content.application/json.schema.properties.total.$ref Could not resolve reference: Evaluation failed on token: "definitions"
I have tested with reitit versions "0.6.0" and "0.7.0-alpha3" with the same results.
I attached a modified version of the malli swagger example to make it easier to reproduce and a screenshot of the error.