@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?
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.
@reshef.mann Thanks, that is an awesome article, and gave me a few ideas
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
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?
Yes, thanks, so I write the library, and just register the generated resolvers and it should work...
yup, your library can for example take some input specs (in open api or something) and return a vector of resolvers
than the user register it, something like:
(pci/register (api-wrapper/create-resolvers some-api-spec))
That's perfect
Thanks again.
what kind of specs are wrapping?
Right now I have 6 different apis I have manually written resolvers for
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.
its on my backlog to have a library to support the Open API protocol
so, if I got right, you are manually doing it per api type? (like service)
Yes all of the apis I am working with seem to have those openapi specs
It seems the hard part is authentication, once I have that, doing post,get,patch,etc is easy.
I also guess the naming translations can be challenging
to make sure everything is correctly identified
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)
pathom.graphql/ident->alias ??
https://blog.wsscode.com/pathom/v2/pathom/2.2.0/graphql/fulcro.html#_keywords_and_graphql_prefixes