ring-swagger

ring-swagger & compojure-api
awb99 2019-09-13T17:22:54.031400Z

This is what I get with (ok 123)

awb99 2019-09-13T17:23:17.032100Z

Is it possible to return integers in the metosin compojure sweet library?

awb99 2019-09-13T17:25:01.032700Z

My usecase is a simple one: I have to re-create the api that one of my frontend componets uses,

awb99 2019-09-13T17:25:11.033100Z

I have the complete api implemented with compojure,

awb99 2019-09-13T17:25:31.033600Z

and returning integer only (without a map as a wrapper) fucks up.

ikitommi 2019-09-13T18:06:00.036300Z

@hoertlehner Hi. I recall you can force the response encoding by defining a :return definition. E.g. with Schema add :return Long to the route. Also validates the response

ikitommi 2019-09-13T18:07:41.039100Z

If you don't want the response validation & swagger docs, you can either a) encode it manually b) add a hint to response that it needs to be encoded

ikitommi 2019-09-13T18:07:56.039700Z

By default, only collections are auto-encoded.

awb99 2019-09-13T18:08:08.039900Z

Oh nice!!!

awb99 2019-09-13T18:08:10.040100Z

It is working!

awb99 2019-09-13T18:08:31.040500Z

I tried that before with :return {:result Long}

awb99 2019-09-13T18:08:47.040900Z

but obviously that meant I return a map with :result property of Type Long.

awb99 2019-09-13T18:08:49.041100Z

🙂

awb99 2019-09-13T18:08:53.041400Z

THANK YOU SO MUCH!!

1