Fork me on GitHub
#reitit
<
2018-11-08
>
ikitommi13:11:25

@socksy coercion defines model for the parameters and has a -get-apidocs function, which turns the parameter models into swagger/json-schema. So, it is needed. Neither clojure.spec or schema has a way good way to decorate the models with arbitrary meta-data for the docs. Spec-tools & schema-tools help here. The coercion definition in route-data doesn't do anything by itself, it's just data. Swagger-endpoints read that as well as the optional coercion middleware/interceptors for the actual request/response coercion.

ikitommi13:11:48

if you just want the docs, and know how to write swagger-schema by hand, you can put that under :swagger, example here: https://github.com/metosin/reitit/blob/master/test/cljc/reitit/swagger_test.clj#L41-L42

ikitommi13:11:44

... in that case, no coercion or spec/schema-tools are needed. This could be in the docs too...

socksy13:11:12

@ikitommi great, thanks for the breakdown