Fork me on GitHub
#pedestal
<
2017-04-04
>
borkdude09:04:41

What’s wrong in this expression?

(route/expand-routes [[["/foo" {:get foo}]]])

borkdude09:04:06

Hmm, this worked: (defroutes routes [[["/foo" {:get foo}]]])

borkdude09:04:16

Apparently I needed to quote the vector before calling expand-routes

ddeaguiar13:04:54

@borkdude, defroutes has been deprecated. You shouldn’t call route/expand-routes if Pedestal’s default-interceptors are being applied since it will expand routes for you. I also recommend using the table route syntax as described here: http://pedestal.io/guides/defining-routes#_a_note_about_routing_syntax

deg13:04:12

What is the recommended way to share a Vase schema with my CLJS client code?

deg13:04:33

(e.g., for client-side validity testing)

ddeaguiar13:04:32

Hrm, I don’t know of a recommended way. There’s the Validation action but that doesn’t involve sharing schema.

ddeaguiar13:04:03

You could share specs between Clojure Clojurescript code but there are some caveats to that. I can’t comment on the practicalities of it since I’ve not done it.

deg14:04:12

The validation action is server-side validation. Often, I'll want some preliminary validation on the client-side too. Even the most basic client needs to know, e.g., whether an input field should be text, password, or numeric. It makes sense to me that this should be driven by the same DRY knowledge as the Vase schemas. But. this doesn't seem to be easy to do, at least not while following the conventions in the Vase samples I've seen.

mtnygard15:04:44

@deg My vision for that is that Vase will be able to generate a Swagger spec to describe itself. Full disclosure though: it's on the roadmap but not being worked right now.

deg15:04:24

@mtnygard That sounds like a very good thing, but I think it may be both too much and too little. Too little: Swagger's syntax is richer than Vase's, so I guess you are talking about a one-time tool to generate an initial Swagger spec. Too much: I envision something simpler - a natural way to compose the Vase .edn file from smaller pieces, some of which would be natural to share with the client code. (My use case is a server and client evolving simultaneously and owned by the same team).

malch16:04:21

Yeah, I'd also want to pass some values to the Vase edn - datomic-uri, for instance. I'm wrapping my whole application in integrant (same with Component, doesn't matter) and would like to pass this config to my server component

borkdude19:04:31

@ddeaguiar I was actually using Pedestal-API which adds another layer of macros to be confused by 🙂