pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
Michael W 2020-12-29T18:53:36.055200Z

@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?

Reshef Mann 2020-12-30T11:59:28.060Z

Interesting discussion. @michael819 - 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 W 2020-12-31T17:55:46.066100Z

@reshef.mann Thanks, that is an awesome article, and gave me a few ideas

Michael W 2020-12-31T17:55:58.066300Z

https://github.com/oliyh/martian

Michael W 2020-12-31T17:56:44.066600Z

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

wilkerlucio 2020-12-29T18:54:54.055300Z

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 W 2020-12-29T18:56:26.056Z

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

wilkerlucio 2020-12-29T18:57:59.056200Z

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

wilkerlucio 2020-12-29T18:58:08.056400Z

than the user register it, something like:

wilkerlucio 2020-12-29T18:58:23.056600Z

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

Michael W 2020-12-29T18:59:48.056800Z

That's perfect

Michael W 2020-12-29T18:59:52.057Z

Thanks again.

wilkerlucio 2020-12-29T19:01:55.057200Z

what kind of specs are wrapping?

Michael W 2020-12-29T19:02:43.057400Z

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

Michael W 2020-12-29T19:04:22.057600Z

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.

wilkerlucio 2020-12-29T19:06:15.057800Z

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

wilkerlucio 2020-12-29T19:06:27.058Z

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

wilkerlucio 2020-12-29T19:06:43.058200Z

https://www.openapis.org/

Michael W 2020-12-29T19:07:38.058500Z

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

Michael W 2020-12-29T19:08:30.058700Z

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

wilkerlucio 2020-12-29T19:08:45.058900Z

I also guess the naming translations can be challenging

wilkerlucio 2020-12-29T19:08:53.059100Z

to make sure everything is correctly identified

wilkerlucio 2020-12-29T19:09:33.059300Z

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 W 2020-12-29T19:13:24.059500Z

pathom.graphql/ident->alias ??