Fork me on GitHub
#pathom
<
2019-04-20
>
rutledgepaulv01:04:04

hi! i recently became aware of pathom and really appreciate the way resolvers compose and let the consumer worry less about how the data is connected / how to navigate to their desired data from what they already have. That said, I’m not a fulcro user and am only looking for read support, not mutations and some of the other things. I have some ideas of what the api for a more minimal / standalone resolver library might look like but i’m struggling with how to go about pathfinding between provided input and desired output. Is there any literature / tips on how to implement that? I’m familiar with basic graph theory but perhaps not how best to model this. could someone who is familiar with it discuss how pathom achieves this with me? I’m guessing a lot of it has to do with what the pathom index looks like.

wilkerlucio01:04:38

hello @rutledgepaulv, welcome 🙂 the path finding of pathom was a pragmatic implementation, I didn't based on any formal literature (although I had past experience writing Dijkstra algorithms), and you guessed right about the index, it has a lot to do with that. There is a section in docs explaining the indexes, had you checked that? https://wilkerlucio.github.io/pathom/#_understanding_the_indexes

rutledgepaulv01:04:04

thanks! No i haven’t looked at those yet. I started trying to write some of the pathfinding stuff and realized I didn’t know how it was working lol

wilkerlucio01:04:11

and that said, I like to just clarify that you don't need to use Fulcro to use Pathom, its a stand alone library, a parser in the end is a function, you can create it and call in any clojure or clojurescript program, no need to integrate with any visual thing. but if really wanna get on the core and write your own I'll be happy to talk about impl details 🙂

rutledgepaulv01:04:41

thanks. I wasn’t sure how connected (ha) it was to fulcro

rutledgepaulv01:04:56

also just curious about how to implement such a thing though

wilkerlucio01:04:26

Fulcro and Pathom have a very good synergy, but are independent things

wilkerlucio01:04:38

if you can understand that snippet I sent, its pretty much all the work on the path finding, based on the index it goes from an input set to some output attribute, it returns all possible paths

rutledgepaulv01:04:16

I’ll look through those and perhaps follow up with more questions

Chris O’Donnell23:04:43

@wilkerlucio Are you open to a PR for https://github.com/wilkerlucio/pathom/issues/86? I'd love to see a solution for it, and I'm happy to do some legwork to make it happen. If you are, it would be great to discuss what you'd like a solution to look like at a high level so I'm not working in a completely different direction. If not, no worries. 🙂

wilkerlucio23:04:11

sure, I would be happy to take a PR for that, I was just looking into the code to see what it takes, and maybe its not so hard, the core would be around this line: https://github.com/wilkerlucio/pathom/blob/master/src/com/wsscode/pathom/connect/graphql2.cljc#L395

wilkerlucio23:04:02

I'm imaging that instead of calling parser-item directly, it could check if there is a ::parser-item defined on the config (so it works in a per-graph impl model), and if a parser-item is provided, it uses that instead of the default one

wilkerlucio23:04:19

so the user can implement an entire custom parser to handle the inner parsing, makes sense?

Chris O’Donnell23:04:46

Yep, makes sense.

Chris O’Donnell00:04:08

Unless I'm missing something, this is a very small change. Do you have any thoughts on how to test it (if you feel that is necessary)?

Chris O’Donnell00:04:44

PR up at https://github.com/wilkerlucio/pathom/pull/91. Happy to add tests or documentation at your discretion.

Chris O’Donnell00:04:31

Smoke tested it using a personal project.

wilkerlucio01:04:17

nice! yeah, I think its a small change, can you also update docs to include this?

Chris O’Donnell01:04:18

Working on it. 🙂 Never used asciidoc before, so progress is a little slow.

wilkerlucio02:04:00

thanks, asciidoc is a bit different but very fun once you get it, also quite powerful 🙂

wilkerlucio02:04:21

tip: if you want to compile the book, you can run make book (you need to have ruby and install the bundle)

Chris O’Donnell02:04:37

Thanks, that was helpful. 👍

Chris O’Donnell02:04:45

Good god, the emacs adoc mode makes indenting code in-buffer impossible.