ring-swagger

ring-swagger & compojure-api
ikitommi 2018-06-12T08:40:32.000030Z

@metametadata oh, it’s not expected, Issue &/ PR welcome.

1👌
Andreasp1994 2018-06-12T18:05:50.000713Z

Hey I am trying out the compojure-api but I am getting this error when doing a post request.`"title": "(not (instance? java.lang.String a-java.lang.Class))"` any ideas what this means?

Andreasp1994 2018-06-12T18:06:05.000188Z

I am following the compojure-api examples form here https://github.com/metosin/compojure-api/tree/master/examples/thingie/src/examples

ikitommi 2018-06-12T18:27:30.000060Z

@andreasp1994 that’s an Schema error for wrong type. What endpoint are you trying?

Andreasp1994 2018-06-12T18:29:15.000282Z

I am trying to do a Todo list REST API based on the pizza example

Andreasp1994 2018-06-12T18:29:49.000710Z

So when I am trying to add a new TodoItem using a POST request on /todos/ I get this error

Andreasp1994 2018-06-12T18:30:20.000809Z

Interestingly if I set the title to an integer lets say 1 I get "title": "(not (instance? java.lang.String 1))"

ikitommi 2018-06-12T18:38:28.000623Z

can you paste you endpoint code?

Andreasp1994 2018-06-12T19:13:43.000548Z

@ikitommi here it is https://paste.ofcode.org/BfWDivFR7gbpeekdm865pK

ikitommi 2018-06-12T19:55:18.000476Z

line 49 should be (ok (add! todo)))

ikitommi 2018-06-12T19:55:46.000446Z

you are returning the schema, and the response coercion fails.

ikitommi 2018-06-12T19:55:53.000731Z

otherwise, looks good

ikitommi 2018-06-12T19:56:33.000603Z

if you get http 500 with schema error, it's response validatipn, 400 is for request

ikitommi 2018-06-12T19:56:40.000014Z

Hope this helps

ikitommi 2018-06-12T19:57:12.000550Z

ping @andreasp1994

Andreasp1994 2018-06-12T20:35:14.000023Z

Oh my god.... Thank you so much.. I can't believe I missed that.

Andreasp1994 2018-06-12T23:46:02.000149Z

Hey is it possible to use swagger with spec rather than Schema???