Fork me on GitHub
#yada
<
2016-09-16
>
kingoftheknoll02:09:58

Question about specifying schema for :responses https://github.com/juxt/yada/blob/master/src/yada/swagger.clj#L121 when I attempt to provide a schema as you would in ring-swagger, I’m given the validation error that the key :schema is not allowed.

[["/resource-counts/" :id]
        (yada/resource
         {:methods
          {:get {:parameters {:path {:id Long}}
                 :produces "application/json"
                 :response (fn [ctx]
                             (let [id (get-in ctx [:parameters :path :id])]
                               (db/harvest-discovery-timeseries id)))
                 :responses {200 {:schema [{:count s/Int :modified_date s/Str}]
                                  :description "List of Harvest Discovery Counts"}}}}})]

kingoftheknoll02:09:35

Looks like I had an old version of Yada “1.1.28”. Upgraded to “1.1.33” and I’m good to go. https://github.com/juxt/yada/blob/7929c38916227b2e028fcae5d7344bf902794b08/test/yada/swagger_test.clj#L220

tcoupland15:09:22

has anyone got a branch of Yada working with clojure 1.9?

tcoupland15:09:15

just wondering if someone's already gone through all the bits and bobs to get this to work, before i go through all the bits and bobs needed to get this to work 🙂

dominicm15:09:57

@tcoupland I wouldn't expect anything to break. Unless there are macro mistakes. But spec should make it obvious & easy.

bhagany15:09:49

I was able to make it run with alpha11 (I think?) with the addition of a colon before require in an ns declaration

bhagany15:09:09

my pull request was merged, but I don’t believe there’s been a release since then

tcoupland15:09:41

i'm trying with 12 and having to upgrade some dependencies to alpha releases

bhagany15:09:12

that’s true, a swagger lib, and aleph needed to be upgraded as well

tcoupland15:09:16

i'll keep trucking, can't be much

bhagany15:09:14

for ring-swagger, it was a colon again, and the same story with my pull request

bhagany15:09:27

aleph already had the appropriate changes committed

malcolmsparks15:09:46

Yes. All working on alpga-12 on yada 1.1.33 but needs latest aleph, manifold and ring-swagger. Some kind contributor fixed yada a couple of months ago

malcolmsparks15:09:28

Can dig out the actual versions I used if you need them @tcoupland but did this exercise earlier in the week

tcoupland15:09:11

i thought i had it then, yada tests past, but my actual project isn't very happy at all

tcoupland15:09:23

@malcolmsparks that would be great, if you've got them

tcoupland15:09:41

i had to change some code, as the middleware functions in aleph have changed names.

malcolmsparks15:09:35

+ [aleph "0.4.2-alpha8"] + [manifold "0.1.6-alpha1"]

malcolmsparks15:09:41

+ [metosin/ring-swagger "0.22.10"]

malcolmsparks15:09:16

I'm not using any aleph middleware (in yada, or my project)

tcoupland15:09:54

sorry, more specifically, there is [aleph.http.client-middleware :as middleware] in the yada.phonebook-test

malcolmsparks15:09:36

ah, I haven't tried developing yada itself on 1.9-alpha, I've only had experience with a project that uses yada as a dependency

tcoupland15:09:06

I think i'll just go that route 🙂

malcolmsparks15:09:34

while clojure 1.9 is in alpha, some lib devs (like me) might ignore it, but clojure 1.9 can't come out of alpha because it will break everyone's projects (because of libraries) - it's going to be clojure.contrib all over again 🙂

malcolmsparks15:09:14

@tcoupland you are on the bleeding edge - so anything you find you need to fix, please send in a PR 🙂

tcoupland15:09:29

i'm bleeding alright

tcoupland15:09:51

i'll let you know if i get stuck 🙂

malcolmsparks15:09:05

if you wouldn't might filling in the yada + clojure 1.9 details as you go... http://c2.com/cgi/wiki?BlackaddersMap