This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-17
Channels
- # announcements (7)
- # babashka (56)
- # beginners (114)
- # bristol-clojurians (4)
- # calva (22)
- # cider (7)
- # clara (1)
- # clj-kondo (17)
- # cljs-dev (1)
- # clojure (93)
- # clojure-europe (8)
- # clojure-italy (5)
- # clojure-nl (2)
- # clojure-uk (79)
- # clojuredesign-podcast (18)
- # clojurescript (108)
- # code-reviews (6)
- # cursive (3)
- # data-science (16)
- # datomic (151)
- # duct (7)
- # emacs (10)
- # events (1)
- # fulcro (76)
- # luminus (8)
- # off-topic (3)
- # other-lisps (2)
- # pathom (8)
- # re-frame (5)
- # reitit (8)
- # schema (9)
- # shadow-cljs (37)
- # specter (3)
- # sql (17)
- # tree-sitter (2)
- # yada (9)
@ikitommi thanks, that will help me later on, but actually for now I'm just trying to get a body with all those properties defined to pass validation. So does that mean that that error suggests that I am getting a nil
body?
@d.marrs the body is either not set or the Content-Type
header is not valid and not triggering the automatic body parsing. Could also be that you don’t have any middleware in the chain to do the body-parsing. I recommend to check out the examples, those have both the required chain on middleware for content-negotiation & body-parsing & commented out the debugging flags to see what is actually happening in the middleware chain. Hope this helps.
@ikitommi I'm not sure what the issue was but it resolved itself. I did have some middleware commented out, and I also have middleware shared between two routers that have been merged together. I think what happened is that I uncommented that correct middleware but that it wasn't detected straight away. I have no idea why that would be the case, but literally what happened is that I left it for 15 mins to clear my head, tried to think about what I was going to do to debug the issue, re-ran the request and got a 200 response.
@ikitommi it may have been the response rather than the request that was causing the problem. It turns out that if I turn :responses
from
:responses {
200 {:body {:success s/Bool}}
}
to
:responses {
200 {:body s/Bool}
}
then I get the same 400 error message as above:
{
"schema": {
"a": "java.lang.String",
"(opt :b)": "java.lang.String",
"c": "java.lang.String",
"d": "java.lang.String",
"(opt :e)": "java.lang.Boolean"
},
"errors": "(not (map? nil))",
"type": "reitit.coercion/request-coercion",
"coercion": "schema",
"value": null,
"in": [
"request",
"body-params"
]
}
oh, I've also altered the handler to return true
rather than {success: true}
. So I'm starting to think this is a bug