Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swagger-ui does generates error when response contains a schema with registry #622

Open
mcuervoe-np opened this issue May 11, 2023 · 0 comments

Comments

@mcuervoe-np
Copy link

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.

Screenshot_3

server.zip

@mcuervoe-np mcuervoe-np changed the title swagger-ui does generates error when response contains a shema with registy swagger-ui does generates error when response contains a schema with registy May 11, 2023
@mcuervoe-np mcuervoe-np changed the title swagger-ui does generates error when response contains a schema with registy swagger-ui does generates error when response contains a schema with registry May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant