Fork me on GitHub
#yada
<
2019-01-22
>
urbanslug06:01:07

Is this a good place to talk about edge? If so, I've watched the demo in the video and looked at the docs. I feel that edge is aimed towards a single repo for all your services. Am I right?

cklaou10:01:47

Hi everyone! I'm experiencing a weird behaviour trying to set the content-security-policy header in a response. It appears that yada appends the default value default-src https: data: 'unsafe-inline' 'unsafe-eval' onto whatever I try to set it to.

dominicm11:01:59

I think there's a key on the resource you should set it with, not manually in the headers. But if you explicitly set it, yada should avoid overriding, please file a bug. That would enable dynamic CSP, I've never needed such a thing though.

malcolmsparks11:01:00

@urbanslug Edge is being aimed at a modular multi-project design. You can keep all projects in the same repo or in different repos. The deps.edn dependency mechanism will work in either case.

urbanslug11:01:12

Thanks ๐Ÿ™‚

cklaou11:01:09

@dominicm Thanks for your response. You are right about not setting it manually. It should be set using top level key :content-security-policy. I confirmed that it works as expected in the latest version 1.2.15. The project that I'm working on has an earlier version though: 1.1.45. Using top level key in the older version does not work and upon trying setting it manually I encountered this behaviour.

borkdude12:01:40

so, since spec isnโ€™t suited for coercion, it seems Schema isnโ€™t going anywhere in the near future and still has a central place in the Clojure community, especially for http API boundaries?

borkdude12:01:16

contrary to the opinion โ€œspec replaces schema, so migrate to specโ€ that you hear here and there

dominicm12:01:59

Although I expect schema's coercion could go behind an interface of some kind.

urbanslug12:01:44

Is there anyone who's just getting into yada and edge? What resource did you use? The docs and code examples seem to be behind the code at this moment.

borkdude12:01:20

I used the docs, edge, the source the yada tests and this channel 2 years ago

borkdude12:01:32

and itโ€™s still running without problems after each upgrade

urbanslug12:01:59

Okay, so say I want to define a route to handle graphql queries. From the docs seems there's a way to define them in yada but there's a way to do so using integrant config in the later versions of edge. I wonder whether one should go with the integrant way or with yada

dominicm12:01:25

@urbanslug for outdated Edge documentation, please open github issues, or contact me directly if you're unsure.

urbanslug12:01:19

I was actually going to try update them in a PR but well it's still confusing.

urbanslug12:01:34

May I use this thread for this communication?

dominicm12:01:38

Absolutely

urbanslug13:01:12

First thing when one is starting out: the dev guide is for development I assume. Following that process "-A:dev:build:dev/build" this alias doesn't apply. I can't quite figure out why. The method in the demo using bin/app project works but limits one to a project inside of edge. This is quite confusing to me so I may not be as clear as I should be.

dominicm13:01:02

This is something I've struggled to convey, I think this needs extra documentation, or perhaps a message in a generated readme.

dominicm13:01:53

Depending on how you generate your project, your dev aliases will be a different list. This is because of sass/figwheel.

urbanslug15:01:46

Also, what if I prefer to use say shadow-cljs instead of figwheel, it doesn't look like changing would be easy.

dominicm15:01:18

kick in theory supports shadow-cljs, but it was commented out by @U050CTFRT. I think he didn't have time to figure out the fixes required for tools.namespace (which are now done for figwheel-main & figwheel-sidecar). https://github.com/juxt/kick.alpha/blob/master/src/juxt/kick/alpha/providers/shadow_cljs.clj.txt

dominicm15:01:35

I would accept PRs to get shadow support working again. I think most of the leg-work is done.

urbanslug15:01:21

I'll look into it. I first have a graphql API to set up, which is what I set out to do in the beginning.

urbanslug15:01:57

Speaking of, in the demo the routes were defined by integrant but then in the yada docs it seems to be through yada. Which is the way you recommend to do it?

urbanslug15:01:22

If my question isn't straightforward just let me know

urbanslug15:01:42

Does one need kick at all with shadow? Shadow does handle building and reloading when files change.

dominicm15:01:02

kick would take care of rebuilding sass for you

dominicm15:01:19

the original idea was that kick would take care of other things too, but we've not had to add anything else for the projects we're currently doing ๐Ÿ™‚

dominicm15:01:03

> Speaking of, in the demo the routes were defined by integrant but then in the yada docs it seems to be through yada. More current thinking is to define in the config.edn. But how granular to go in config.edn is still under consideration. I recommend doing whatever you find works for you ๐Ÿ™‚

urbanslug06:01:26

> kick would take care of rebuilding sass for you Ah this would be nice. My hack is to run a node-sass process in the background.

urbanslug06:01:02

> More current thinking is to define in the config.edn. But how granular to go in config.edn is still under consideration. Awesome I think this answers my question

urbanslug12:01:35

In this case I do want to use integrant and lacinia I'd say

borkdude12:01:54

@urbanslug you should talk to @kwladyka, he just figured this all out

borkdude12:01:04

and then make issues about documentation ๐Ÿ™‚

cklaou13:01:06

Got another one: Trying to upgrade the yada in a project from 1.1.45 to latest -`1.2.16` and I can't start a repl due to java.lang.RuntimeException: No such var: s/constrained refering to yada/schema.clj:22. ,If anybody can provide a hint I would be grateful. I checked the changelog and there's no use of multi-arity responce functions in the project (or any other breaking change)

dominicm13:01:47

@chris.klaou does your project have a schema dependency?

dominicm13:01:55

@chris.klaou probably worth checking with lein deps :tree for conflicting schema versions,

cklaou14:01:23

I tried that and found out that theres another lib, namely circleci/rollcage that depends on [prismatic-schema "0.4.3"] and under yada there's no dependency on schema

cklaou14:01:44

Tried to exclude prismatic/schema from both yada and rollcage and include top level dependency on [prismatic-schema "1.1.7"] and the problem remains.

dominicm15:01:02

weird that there's both prismatic-schema and prismatic/schema.

dominicm15:01:32

I think that was a typo, rollcage depends on prismatic/schema

cklaou15:01:08

typo on my behalf

cklaou15:01:23

I meaned that the output of lein deps :tree command had no schema dependency underneath yada

cklaou15:01:04

because aparrently it was overriden by the earlier version on which rollcage is dependent

dominicm13:01:25

You can probably subvert that work by adding a dependency on a new schema to your project