Fork me on GitHub
#luminus
<
2017-10-19
>
mmer13:10:30

@ikitommi Thanks for the suggestiong - I changed the schema to : (s/defschema Messages [s/Str]). I have tried simply outputting a list of strings ("message" "Message2") and it still get { "errors": "(not (sequential? a-java.lang.String))"} response I changed the output then to use json/write-str to output the list and I get the same error. I must be doing something really silly.

ikitommi14:10:29

@mmer you don’t have to write the output to JSON by hand. Just return the clojure data from the route and it gets encoded based on the client accept headers. e.g. return something like (ok ["kikka" "kukka" "kakka"]) and it should work.

ikitommi14:10:06

or (ok [{:?message "kikka"} {:?message "kukka"}]) in the first sample.

ikitommi14:10:25

if you write JSON manually, e.g. (json/write-str ["kikka" "kukka" "kakka"]), you are returning a JSON String and the Schema validation fails: :return denotes you should return a vector of String, and returning the (JSON) String gives the error you are seeing.

ikitommi14:10:28

hope this helps.

mmer15:10:58

Thanks @ikitommi - I tried variations of what you said and eventually it has worked - much appreciated.