Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Tyler Hoppe
    @leguma
    It made sense for my use case. Modify to your liking.
    Tyler Hoppe
    @leguma
    For me, I wanted to grab everything starting with "file", such as "file[0]" or "files" etc. It returns a collection, which is what I wanted. You can modify the above to take a predicate or something to pass into the filter eval if you want something flexible
    Tyler Hoppe
    @leguma
    Blech. This multipart issue is killing me. I'm proxying a multipart call (with some transformation) to another yada multipart endpoint, so the chance of it failing on request body parsing is exponential. The more files, the more likely it is to occur. It appears that if files appear in a certain order, it happens more or less. I'll try to figure out a pattern today
    Tyler Hoppe
    @leguma
    juxt/yada#291 Should be pretty easy to reproduce, if you play around with files of different sizes. I'll put my ad hoc test results there to assist reproduction, just in case.
    Eugene Pakhomov
    @p-himik
    @leguma I just answered on GitHub. It's pretty easy to apply the fix outlined there within your own project.
    Tyler Hoppe
    @leguma
    Thanks! Do ya' have plans to submit a PR?
    Eugene Pakhomov
    @p-himik
    @leguma Initially I wanted to, but I couldn't come up with a reliable test case.
    Tyler Hoppe
    @leguma
    @p-himik I went ahead and submitted a PR for this: juxt/yada#303
    It's against 1.2, assuming they've got some sort of merge-forward strategy to take care of the rest
    geraldodev
    @geraldodev
    regarding the yada version to use on a starting project in development phase. which version to use ? 1.4.0-alpha-1 1.3.0-alpha-12 ?
    Malcolm Sparks
    @malcolmsparks
    I recommend staying on 1.2 until we announce the resolution of our authentication/authorization planning work
    Gaurav Rampal
    @r4mp4l
    Hi,

    Im trying to learn clojure & make a web app so I thought I'd use Yada. However, the instructions fail when I try to run:

    git clone https://github.com/juxt/edge
    cd edge/app

    There is no directory called app.

    Would anyone be able to help me with this?

    Eugene Pakhomov
    @p-himik
    @r4mp4l Hi. The Yada's manual is not up to date with the current version ofEdge. Use this: https://juxt.pro/edge/docs/setup.html
    Also note that Yada/Edge might be a bit too much for a Clojure novice, so continue at your own discretion.
    Gaurav Rampal
    @r4mp4l
    thank you
    Gaurav Rampal
    @r4mp4l
    @p-himik what is the best tool-chain for a novice please ? Getting that right is taking a lot of time.
    Eugene Pakhomov
    @p-himik
    @r4mp4l To be honest, I have no idea. After a quick search, I think I'd first look at one of these:
    http://pedestal.io/
    http://www.luminusweb.net/
    https://coastonclojure.com/
    See the examples and the guides on the corresponding websites, choose what you like best and experiment.
    Note that I tried to look for frameworks. If you're not comfortable with frameworks and want instead just a simple web server, your best starting point is probably Ring: https://github.com/ring-clojure/ring
    Gaurav Rampal
    @r4mp4l
    Thank you very much
    Ghost
    @ghost~595e3eded73408ce4f6be9b8
    Hey folks - Does yada support using clojure.spec to define APIs? After quickly looking at the source, it looks like only Schema is supported
    Eugene Pakhomov
    @p-himik
    @markaddleman_twitter I think that's correct - prismatic/schema is used everywhere and I don't see any way to use your own coercers.
    Ghost
    @ghost~595e3eded73408ce4f6be9b8
    @p-himik THanks
    Paul Iannazzo
    @boxxxie
    I'm making heavy use of mulitpart form encoded requests. I noticed there are many open issues for the mulitpart code. is there an easy way to swap out the mulitpart parser for something else?
    Dominic Monroe
    @SevereOverfl0w
    sbitteker (Gitter): You can use a var like #'my-resource with yada to refer to something that may change.
    What bash emulator were you using?
    sbitteker
    @sbitteker
    I see in the docs you can use Plumatic Schema for ensuring types, like :methods {:get {:parameters {:query {:since String}}}} Can someone point me to away to install custom query parameter predicates that when false will return a help message and a 400. Say for instance the parameter must be in a set of Strings (contains? #{"low" "medium" "high"} the-param) (as a contrived example) {:parameters {:query {:since (sch/validate (sch/constrained String #(contains? #{"low" "medium" "high"} :since) "Wrong setting. it must be low, medium or high.") :since)}}}
    sbitteker
    @sbitteker
    Or is the idea that only types are validated in the :parameters with plumatic/schema and any further parameter validation is done in the :response function?
    Bernard Labno
    @blabno
    Hi, is there a way to detect if http connection has been closed by client?
    Caleb Whiting
    @szaver_gitlab
    I'm trying to follow chapter 2 of the yada guide, but it seems to be out of date.
    It says to run the following:
    git clone https://github.com/juxt/edge
    cd edge/app
    But the edge repository has no folder named app.
    What's up, and how do you recommend I proceed?
    Paul Iannazzo
    @boxxxie
    yada guide is old and incomplete
    you don't need edge to learn yada, but i found that something like edge, and other apps that use yada, to be good resources on how to do things with yada that aren't explained in the manual
    also, would recommend looking into https://metosin.github.io/reitit if you are looking at yada/bidi
    Eugene Pakhomov
    @p-himik
    An up to date (I think) Edge guide is at https://juxt.pro/edge/docs/setup.html
    Ryan Riley
    @panesofglass
    I'm trying to set up a yada example (simple yada, no edge) for benchmarking https://github.com/the-benchmarker/web-frameworks/pull/3449/files. Can someone help me with an error I'm getting when running locally? When I run locally, I get the following:
    └─ ▶ java -jar yada.jar 3000
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by Capsule (file:/mnt/c/Users/ryanr/Code/OSS/web-frameworks/clojure/yada/yada.jar) to field com.sun.jmx.mbeanserver.JmxMBeanServer.mbsInterceptor
    WARNING: Please consider reporting this to the maintainers of Capsule
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    Syntax error (ClassNotFoundException) compiling at (aleph/http/client_middleware.clj:420:7).
    javax.xml.bind.DatatypeConverter
    
    Full report at:
    /tmp/clojure-12964805541297260983.edn
    Eugene Pakhomov
    @p-himik
    @panesofglass Looks like your Aleph version is incompatible with your Java version.
    Ryan Riley
    @panesofglass
    @p-himik how do I fix that?
    I'm quite new to clojure (and the JVM for that matter)
    Eugene Pakhomov
    @p-himik
    @panesofglass You can try adding the latest version of Aleph to your dependencies.
    Ryan Riley
    @panesofglass
    Thanks, @p-himik. That got me to a different error:
    └─ ▶ java -jar yada.jar 3000
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by Capsule (file:/mnt/c/Users/ryanr/Code/OSS/web-frameworks/clojure/yada/yada.jar) to field com.sun.jmx.mbeanserver.JmxMBeanServer.mbsInterceptor
    WARNING: Please consider reporting this to the maintainers of Capsule
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by clojure.lang.InjectedInvoker/0x0000000800232040 (file:/home/ryan/.capsule/apps/null_null/org.clojure__clojure__1.10.1.jar) to method com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(org.xml.sax.InputSource,org.xml.sax.HandlerBase)
    WARNING: Please consider reporting this to the maintainers of clojure.lang.InjectedInvoker/0x0000000800232040
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    Execution error (ClassCastException) at aleph.http.server/start-server (server.clj:481).
    class java.lang.String cannot be cast to class java.lang.Number (java.lang.String and java.lang.Number are in module java.base of loader 'bootstrap')
    
    Full report at:
    /tmp/clojure-748032621812254644.edn
    interesting; I wonder what's being cast from string to number?
    Ryan Riley
    @panesofglass
    Okay, I fixed that by parsing the incoming port. Now it looks like I have some routing issues, but otherwise I think I'm set. Any chance you could take a look at the routes to see what I may have goofed?
    Eugene Pakhomov
    @p-himik
    Just post the data here and describe what makes you think that there are routing issues. Maybe I or maybe someone else will take a look.
    Ryan Riley
    @panesofglass
    Thanks! Here's my app:
    (ns server
      (:require
       [clojure.tools.logging :refer :all]
       [yada.yada :as yada]))
    
    (def index
      (yada/resource
        {:methods
         {:get
          {:produces "text/plain"
           :response ""}}}))
    
    (def postuser
      (yada/resource
        {:methods
         {:post
          {:produces "text/plain"
           :response ""}}}))
    
    (def getuser
      (yada/resource
        {:parameters {:path {:name String}}
         :methods
         {:get
          {:produces "text/plain"
           :response
           (fn [ctx]
             (let [name (get-in ctx [:parameters :path :name])]
               name))}}}))
    
    (def app
      ["/"
       [["" index]
        ["user"
          [["" postuser]
           ["/" :name] getuser]]]]) 
    
    (defn -main [& [port]]
      (yada/listener app {:port (Integer/parseInt port)}))
    The index and postuser resources respond correctly with 200 OK and no content. However, getuser returns the following:
    java.lang.UnsupportedOperationException: nth not supported on this type: Resource
        at clojure.lang.RT.nthFrom(RT.java:991)
        at clojure.lang.RT.nth(RT.java:940)
        at bidi.bidi$match_pair.invokeStatic(bidi.cljc:195)
        at bidi.bidi$match_pair.invoke(bidi.cljc:195)
        at bidi.bidi$eval12083$fn__12084$fn__12085.invoke(bidi.cljc:336)
        at clojure.core$some.invokeStatic(core.clj:2701)
        at clojure.core$some.invoke(core.clj:2692)
        at bidi.bidi$eval12083$fn__12084.invoke(bidi.cljc:336)
        at bidi.bidi$eval11956$fn__11970$G__11945__11977.invoke(bidi.cljc:183)
        at bidi.bidi$match_pair.invokeStatic(bidi.cljc:202)
        at bidi.bidi$match_pair.invoke(bidi.cljc:195)
        at bidi.bidi$eval12083$fn__12084$fn__12085.invoke(bidi.cljc:336)
        at clojure.core$some.invokeStatic(core.clj:2701)
        at clojure.core$some.invoke(core.clj:2692)
        at bidi.bidi$eval12083$fn__12084.invoke(bidi.cljc:336)
        at bidi.bidi$eval11956$fn__11970$G__11945__11977.invoke(bidi.cljc:183)
        at bidi.bidi$match_pair.invokeStatic(bidi.cljc:202)
        at bidi.bidi$match_pair.invoke(bidi.cljc:195)
        at bidi.bidi$match_route_STAR_.invokeStatic(bidi.cljc:382)
        at bidi.bidi$match_route_STAR_.invoke(bidi.cljc:380)
        at bidi.ring$make_handler$fn__12917.invoke(ring.clj:35)
        at aleph.http.server$handle_request$fn__6104$f__807__auto____6105.invoke(server.clj:158)
        at clojure.lang.AFn.run(AFn.java:22)
        at io.aleph.dirigiste.Executor$Worker$1.run(Executor.java:62)
        at manifold.executor$thread_factory$reify__689$f__690.invoke(executor.clj:44)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.base/java.lang.Thread.run(Thread.java:834)
    looking at it now that I've pasted it, the answer is painfully obvious.
    Paul Iannazzo
    @boxxxie
    I have an issue with :authentication data in a resource not being accessable when in an error handling interceptor (the resource has the data, the error handler doesn't)
    Paul Iannazzo
    @boxxxie
    I think my issue is related to the differences in the interceptor chains and error-interceptor chains. is it the case that in an error, the error-interceptor chain is started without any of the previous context of the interceptor chain? and is it ok for me to go against this, or would it cause fundamental problems for me?