Fork me on GitHub
#clojure-uk
<
2020-07-24
>
dharrigan07:07:50

Good Morning!

rickmoynihan08:07:20

Does anyone know the current situation with json-schema? When I last used it (several years ago) the spec was underspecified and lots of implementations were incompatible. In particular JSON pointers were a bit of a nightmare. Have things improved?

dominicm08:07:44

Someone took the helm again and pushed v8, but I've not followed since then

alexlynham08:07:12

it's okay, but recently I've found typescript interfaces at the edge of our system have solved that problem better, with better integration and editor tooling & it's faster too

dominicm11:07:14

You'll struggle to share TS definitions across network boundaries though. JSON schema is a tool of communication.

alexlynham12:07:00

true, I guess depends how much of your domain is in your control

alexlynham12:07:27

atm working on a system that's backend and very much glue so we don't have to share our defs with e.g. a frontend

alexlynham12:07:44

although if they were TS I think we'd monorepo nad share the defs that way

folcon13:07:58

Mornโ€™

maleghast14:07:59

Hello Alll ๐Ÿ™‚

maleghast14:07:28

Does anyone happen to know how to update the exec-path in Spacemacs flavoured Emacs..?

maleghast14:07:37

I have never had to do it before, but suddenly, on my work machine (Ubuntu 20) Emacs is no longer seeing my ~/bin folder which is where I put lein

maleghast14:07:54

(also, I'ved not had to use lein for a while as I was all tools-deps all the time, but I've been overruled by my team and we are back to Leiningen) (I don't care, I just can't cider-jack-in to the prototype I am working on because of this exec-path stuff)

alexlynham14:07:27

do you use the exec-path-from-shell plugin? that seems to mostly sort it out for me

maleghast15:07:42

Thank @alex.lynham - I will look at that, sounds like a plan

maleghast15:07:40

Odd question - anyone else getting an aleph error when trying to evaluate a namespace where [yada.yada :as yada] is in the :require..?

maleghast15:07:56

If I comment it out, clearly no errors, but I want yada in that namespace

maleghast16:07:02

This is why I should have learned about Java properly, this stacktrace is mental and it appears to be to do with a transitive dependency to the library I am trying to use... https://gist.github.com/maleghast/3cfb6b8a7da2d648b87c6fcf43f148f5

maleghast16:07:22

Does anyone have any idea what is goin on there ^^

seancorfield16:07:57

Looks like a Java 9+ compatibility issue with one of the libs you are using, or maybe how your REPL is getting started?

seancorfield16:07:48

javax.xml.bind.DatatypeConverter is one of the usual culprits in Java 9+ issues regarding bootclasspath or something like that...

maleghast16:07:53

Oh... Yeah, I am using Java11

maleghast16:07:30

How would I fix that, without going back to Java8?

maleghast16:07:28

More importantly, how do I get Yada to be compatible with a more up to date JVM than Java8 - I love the way that Yada works, but I am not comfortable relying on a JVM that is about to EoL

maleghast16:07:54

@seancorfield - FWIW I switched back to Java8 and the code runs, so I am now pretty sure that you are right

Ben Hammond07:07:57

XML is treated as a seperate module in Java 9that you have to turn on as a commandline switch

Ben Hammond07:07:06

now if only I could remerber what that was

Ben Hammond07:07:30

Meh unfortunately I have that stuff on Ubuntu; and I'm booted into Windows for current client work

Ben Hammond07:07:33

it was also possible to solve by including java xml dependencies into lein/deps/mvn to bring the processing code into your main user space

Ben Hammond07:07:00

something like

java --add-modules java.xml
on the startup command perhaps?

Ben Hammond07:07:13

:jdk11
  {:extra-deps {com.sun.xml.bind/jaxb-core {:mvn/version "2.3.0.1"}
                com.sun.xml.bind/jaxb-impl {:mvn/version "2.3.0.1"}
                 {:mvn/version "2.3.1"}
                javax.xml.bind/jaxb-api {:mvn/version "2.3.0"}
                javax.activation/activation {:mvn/version "1.1.1"}}}

Ben Hammond07:07:35

since I'm here

maleghast14:07:54

Ooh, thanks @U793EL04V ๐Ÿ™‚

seancorfield16:07:55

The stacktrace suggests it's Aleph, specifically. Which is pretty much no longer maintained?

seancorfield16:07:01

(and Yada uses Aleph)

seancorfield16:07:01

I'm surprised at this point it hasn't all been updated to work properly with Java 9+ tho'... although we ended up switching a couple of our Java library deps because they were taking so long to fix Java 9 compatibility issues in the end ๐Ÿ˜

maleghast17:07:45

Ah, bummer... I did not know that Aleph has become abandonware - it always struck me as a great library

maleghast17:07:42

I'll drop Malcolm a DM and ask him if there is a plan, and if not see if we can fork our way to a working version, even if that's some work... ๐Ÿ˜‰

dominicm21:07:27

I think yada works under java 11 as is on the latest alpha (Which is stable and should be cut as a release)

maleghast14:07:04

I will check to see if that works - does this mean that the fix is in Yada, or has Aleph been updated to work on an "unstable" branch that is actually stable?

seancorfield17:07:16

So there are plans to get to a 1.0 but it sounds pretty minimal.

maleghast17:07:21

Crikey! Thanks for the info @seancorfield - I am stunned, Aleph always seemed to me that it would be around forever; such a shame... I wonder if this is all part of Zac falling out of love with Clojure... ๐Ÿ’ฃ

Joe17:07:13

@maleghast Thatโ€™s a shame heโ€™s not so into it any more, I was a big fan of Elements. Has he written anywhere about why he moved away from it?

Joe17:07:22

Clojure I mean, not Aleph

seancorfield17:07:59

@U0105JJK1L3 He has talked about, yes. I don't have specific links to his reasons. Part of it was due to his work on tuples being rejected/rewritten by Rich after he (Zach) had put a lot of work into.

maleghast17:07:32

@U0105JJK1L3 -Yeah the impression I got is that he changed jobs and was upset by the way his work on tuples was treated by the core committers and just decided to pursue other interests. Clearly I don't want to speak for him, and I am sure he'd be prepare to tell you himself. I agree about Elements of Clojure by the way, really great book.

seancorfield17:07:30

Several people who were very active in the early days have left the community (and the language) after disputes about stewardship of the language -- and I must admit, I clashed with Rich and some of the other core committers occasionally in the early days, but I ultimately accepted it's Rich's project and he's going to run it the way he wants and if you're going to contribute, you just have to get on board with that.

seancorfield17:07:11

In a decade of using Clojure, I've had one tiny little patch accepted into Clojure itself, and I've contented myself with maintaining a lot of projects -- some in Contrib, some outside.

maleghast18:07:31

Yeah, I've never had the time or the chops (frankly) to get to a place where I was looking to try and contribute, so it's not touched my life... I am genuinely thankful that smarter people than me are there making Clojure the wonderful day to day professional programming experience. If i ever decided I didn't like it any more there are plenty of other languages I might consider, but the way that the project is run is not a factor in my feelings on the matter ๐Ÿ™‚

seancorfield17:07:30

I like Zach, he's really smart, but his projects have nearly always seemed really... weird...

maleghast17:07:32

Yeah, no doubt...

maleghast17:07:53

What are people using instead of Yada these days then..?

maleghast17:07:29

As I just said in another window, I've not had to develop something from scratch for a good long while and this experience has uncovered some concerns to say the least...

maleghast17:07:33

I would like to carry on using Bidi / Yada as I like the way that they work together, but the reliance on Aleph and Aleph having an uncertain future makes me wonder what others in this community have been "picking" if they are starting a new project in the last few weeks / months...?

seancorfield17:07:09

I've never needed anything more sophisticated than Jetty, to be honest. Although we have one system at work that has been built directly on Netty via Java interop in two of its incarnations over the years.

seancorfield17:07:41

We ran http-kit in production for a while, but New Relic didn't support it very well so our metrics were sub-optimal. So we switched (back) to Jetty, which we'd originally used but abandoned due to random thread death errors (which got fixed by the time we went back to it).

maleghast17:07:58

So are you just using Compojure @seancorfield..?

seancorfield17:07:33

Bidi on one service (built on Jetty). Compojure in everything else, except the one Netty-based service.

maleghast17:07:45

I mean I think that Yada could be re-tooled to run on Jetty as the server, although a lot of the async stuff would be problematic...

maleghast17:07:19

Bidi -> Bare Ring Handlers or are you using some other abstraction over Ring?

seancorfield17:07:04

Ring is a perfectly good abstraction IMO. Clean, simple, obvious. And it does have async support (although it's a bit limited, I gather -- we've never used it).

maleghast17:07:46

Yeah, I am absolutely not dissing it, I think that Ring is amazing, I just got used to Yada and the extra bits of convenience and power I got out of it.

maleghast17:07:21

I started building REST APIs in Clojure with Liberator and Yada was a nice middle ground of power and features without being as complex to work with as Liberator

maleghast17:07:59

I could go back to Liberator to get the REST API structure stuff and to be honest there is an attraction in the strictness of that

seancorfield17:07:34

We're happy enough with Compojure for a REST-like API without all the bells and whistles.

maleghast17:07:50

I realise it's not a like for like comparison, but I used to build APIs on Rack in Ruby, and that's like rolling one's own just on Ring in Clojure, so it should feel pretty comfortable for me, I really think that I just got spoiled (in a good way, again not a a criticism) with what Yada did for me.

seancorfield17:07:29

I looked at Yada at one point and it just seemed like too much "magic" going on if I recall...

seancorfield17:07:43

(and maybe that was because it was built on Aleph/Manifold)

maleghast17:07:24

Yeah, I can see that being the impression for sure - there was a learning curve in adopting it, but the payoff was automatic content-negotiations, good boundary hygiene around what resources could be used for and best of all the whole API was decoupled from the routes / routing.

maleghast17:07:16

I've gone back and looked at Compojure and I have to admit that there is clearly an argument for a different kind of ease of use there, and let's face it it's very widely used so it's widely understood which is not nothing.

maleghast17:07:09

Overall I am wondering if it's worth worrying about doing anything other than Compojure / Compojure-API

seancorfield17:07:26

If I needed the whole content negotiation thing and/or auto-generated API docs, I'd look at a more sophisticated library that handled that stuff.

seancorfield17:07:49

But I really do like simplicity in libraries and I'd prefer to compose several small, independent things if I could, rather than adopt something all-purpose.

maleghast18:07:22

I am eyeing up reitit from metosin as an altgernative to Yada and Bidi, in that it has a bidirectional routing approach like Bidi

lfn310:07:34

Malcom gave a talk at ClojureD with a chunk on Yada: https://youtu.be/gMYQ1vDy7d0?t=1494. Seems like they're looking at putting effort into a new think called Apex: https://github.com/juxt/apex which uses ring and leans on OpenAPI (fka swagger)

maleghast18:07:35

Thanks for the presentation link I am going to go check that out...

๐Ÿ‘ 1
dharrigan20:07:59

I use reitit

dharrigan20:07:04

works very well

dominicm21:07:23

Yada handles a lot of http that ring doesn't. Or rather, ring is an abstraction over the http protocol, and yada is a proper implementation of http specs.

dominicm21:07:51

You should not be choosy about implementing specs. You should attempt to be comprehensive. Ring forces the developer to take care of all of that themselves. I think that's okay, but ring is too low level to be working at regularly. "Need" of compliance is a funny one, because your clients (not you) care about you being compliant.

seancorfield21:07:35

It's probably also worth pointing out that browsers, proxies, and CDNs can all conspire to break HTTP requests that are not just GET/`POST`/`HEAD`/`OPTIONS` -- so PUT/`PATCH`/`DELETE` cannot be assumed to work universally, which means the HTTP spec is not as useful as some people think ๐Ÿ™‚

seancorfield21:07:02

(updated to say "CDNs" instead of "load balancers" now that I've remembered it was CloudFront that caused us some pain there, not the F5 Big-IP ๐Ÿ™‚ )

dominicm21:07:58

Broken proxies break http? Shocker :)

seancorfield21:07:03

(and, no, I no longer remain exactly what that pain was, but it was enough of a problem that we quickly abandoned put/patch/delete as universally viable HTTP verbs)

dominicm21:07:32

CDNs don't make sense on that list really. You don't control those, and you can't make those kinds of requests to them.

seancorfield21:07:59

Our customer base is global, many in Africa and the Middle East, so strange browsers/devices and nasty proxies are bread and butter for us, unfortunately.

djm06:07:55

Most of our users still use IE11 thisisfine

seancorfield06:07:11

@U015KH5ENEM Luckily, we can choose to not support Internet Explorer but I know corporate-targeted apps still have to support it.

dominicm21:07:26

Browsers work fine with all the methods afaik anyway. Never heard otherwise. There's limits to the methods available in forms, but there's other details behind that.

dominicm21:07:51

Maybe partially implemented browsers on old devices or something?

dominicm21:07:02

As in, pre-smartphone

seancorfield21:07:15

I can't remember exactly how the CDN played into the equation now. But it was a contributing factor.

dominicm21:07:45

Content negotiation is still valuable regardless. Having language automatically managed correctly according to browser headers is a win. Same for things like encodings for reducing bandwidth use.

dominicm21:07:23

Or setting vary headers, so caching proxies behave correctly.

seancorfield21:07:57

(we are somewhat "saved" by having our REST-ish API only called by our own React.js SPA -- if we had a public REST API, I would want more HTTP compliance)

dominicm21:07:04

I think the web is missing a high level http client that assumes things like caching are implemented, and allows you to skip a bunch of steps even for internal applications.

dominicm21:07:45

Eg knowing that 400 means client error, and handling the form appropriately

seancorfield21:07:35

Yeah, given what we try to do on the web these days, it often feels like we're shoehorning a lot of stuff into what was originally a very simple text-based protocol ๐Ÿ˜

dominicm21:07:26

I think the goal was always accretion. A surprising amount of stuff is in the early specs. Including caching and proxy headers.

๐Ÿ‘ 2