Fork me on GitHub
#pathom
<
2020-12-29
>
Michael W18:12:36

@wilkerlucio I've just read the docs for pathom 3. Would the plugin system allow me to add resolvers based on a spec? For example with rest apis I am doing the same operations over and over. I'd like to take the api spec, usually in json, then generate resolvers automatically. I'm already generating quite a few functions at compile time to make it easier on myself. I just wonder if spending the next month on this would be wasted, because I don't really understand the plugins from the existing docs, and am still a beginner with clojure. My question is would the plugin architecture be the place to start, or should I write it as a library?

wilkerlucio18:12:54

for that you don't need plugins, plugins are for hooking inside pathom operations as they occur, the generation of resolvers is something you can do ahead of time, and then register them, so you don't need plugins for that, makes sense?

Michael W18:12:26

Yes, thanks, so I write the library, and just register the generated resolvers and it should work...

wilkerlucio18:12:59

yup, your library can for example take some input specs (in open api or something) and return a vector of resolvers

wilkerlucio18:12:08

than the user register it, something like:

wilkerlucio18:12:23

(pci/register (api-wrapper/create-resolvers some-api-spec))

Michael W18:12:48

That's perfect

Michael W18:12:52

Thanks again.

wilkerlucio19:12:55

what kind of specs are wrapping?

Michael W19:12:43

Right now I have 6 different apis I have manually written resolvers for

Michael W19:12:22

I'm wanting to add a few more, and going back over my code there is a lot of repetion. I am kinda wanting to make a generic rest library to wire in any kind of rest api. It's barely an idea at this point but it beats writing the same functions over and over.

wilkerlucio19:12:15

its on my backlog to have a library to support the Open API protocol

wilkerlucio19:12:27

so, if I got right, you are manually doing it per api type? (like service)

Michael W19:12:38

Yes all of the apis I am working with seem to have those openapi specs

Michael W19:12:30

It seems the hard part is authentication, once I have that, doing post,get,patch,etc is easy.

wilkerlucio19:12:45

I also guess the naming translations can be challenging

wilkerlucio19:12:53

to make sure everything is correctly identified

wilkerlucio19:12:33

I suggest doing some sort of prefix (like Pathom 2 does for GraphQL) in order to enable better integration without entity name collision (when handling many different services)

Michael W19:12:24

pathom.graphql/ident->alias ??

Reshef Mann11:12:28

Interesting discussion. @UAB2NMK25 - take a look at this: https://vvvvalvalval.github.io/posts/2018-07-23-datascript-as-a-lingua-franca-for-domain-modeling.html Looks like he lays an approach to what you try to achieve. Hopefully you'll find it useful.

Michael W17:12:46

@U015R6SQ77Z Thanks, that is an awesome article, and gave me a few ideas

Michael W17:12:44

I found that too which looks like it does exactly what I wanted but I cannot seem to get it to work against http://swapi.dev as a test