This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-16
Channels
- # beginners (11)
- # boot (21)
- # cider (12)
- # clara (6)
- # cljs-dev (7)
- # cljsjs (1)
- # cljsrn (62)
- # clojure (137)
- # clojure-austin (5)
- # clojure-italy (1)
- # clojure-nl (2)
- # clojure-russia (46)
- # clojure-spec (21)
- # clojure-uk (79)
- # clojurescript (56)
- # clr (1)
- # core-typed (1)
- # css (1)
- # cursive (3)
- # datomic (35)
- # docker (2)
- # emacs (20)
- # garden (3)
- # hoplon (8)
- # incanter (3)
- # jobs (12)
- # mount (5)
- # nginx (1)
- # off-topic (71)
- # om (8)
- # om-next (6)
- # onyx (4)
- # perun (3)
- # proton (2)
- # protorepl (5)
- # re-frame (35)
- # reagent (38)
- # ring (5)
- # ring-swagger (12)
- # rum (35)
- # spacemacs (2)
- # specter (5)
- # test-check (6)
- # yada (52)
Hi @geek-draven - for a project.clj driven yada, take a look in dev/ and following the instructions in the README to get the dev project up - that's the project I work in when I'm developing yada and it currently has some simple examples and the manual is available. This is all on the master branch.
A good rule-of-thumb is to get acquainted with yada internals by looking at the code. The core is not that complex, it's really just a chain of functions passing along a single argument (called the context)
There's a lot of code in yada but once you understand where the pieces fit, you can ignore a great deal of it
@geek-draven - a technical point but the routing is edge is done with bidi. In yada, you secure each resource individually - you can automate this using a clojure.walk/postwalk or find many alternative ways of adding authorization to the resource data
The 2 interceptors are authentication and authorization - once you understand how they work it's quite powerful
@naartjie - no, but you could avoid declaring {:parameters {:body ...}}
and handle the body yourself
@naartjie But I see that it's not ideal - what's your use-case?
@malcolmsparks we have a post which takes no body or alternatively a {:comment String}. I could try have a go at a PR
yes - do you think you can detect a (s/optional-key :body)
?
@naartjie in the PR
@malcolmsparks the github repo says to use [yada "1.2.1"]
but it hasn't been published
My bad, sorry, use 1.2.0
Broadly compatible, but test ofc
@stijn I found that the optional body used to work for us, in 1.1.18 at least, after upgrading to 1.2.0 I haven't found a way to make it work. Also, if you were throwing ex-info with :body in ex-data, that will be respected now.
@malcolmsparks I could sure try ;)
For the body schema something like :body (s/maybe schema)
for the :parameters definition of the resource should be the expected from the user?
This is because https://github.com/juxt/yada/issues/110 was fixed
how should you manipulate the interceptor chain in 1.2.0? as =>> No such var: yada.resource/insert-interceptor
those convenience functions have gone to yada.handler
the idea is that yada.yada is the API - if you depend on anything outside of yada.yada then it might break
this allows me to refactor while keeping the API compatible
the multimethod in yada.yada is new and still experimental, don't depend on it yet
that's why I said 'broadly compatible' 🙂
in future, I'm going to take care to keep yada.yada stable - of course there are some functions that I've indicated in documentation and elsewhere outside of yada.yada which I shall clean up - consider everything outside of yada.yada to be risky to depend on
@malcolmsparks so in orther words if we're doing
(defmethod yada.security/verify :jwt ...)
and
(defmethod yada.authorization/validate ...)
in our code we should definitely watch out 🙂
Those will be moved into yada.yada at some point
this is weird, if i switch from 1.1.45 to something higher (also 1.1.46) every GET with a 200/OK has an empty body
Really? Which version
Is there some cacheing thing?
Try 1.1.47
1.2.0 ?
that can't be right
I'm using yada 1.2.0 and I would certainly notice that!
i think i have something messed up with the interceptors as it never enters the fn in :response
ah, that's possible
@malcolmsparks Thanks Malcolm, I've made some progress today and got the server working, now just need to figure out where I went wrong with my yada resources as the page is displaying the raw html code
@geek-draven Make sure you're declaring :produces mediatype to be text/html :)