WSSCode Blog

Pathom Updates 6, New processing goodies

January 09, 2021

Happy new year everyone!

This is the first post of the year, and I’m excited about this one. I just made available a few features that I’ve wanted for years to be in Pathom, and now they are!

Optional inputs

I’ve seen a fair amount of requests for this feature in the #pathom Slack channel over the years. It’s a simple idea, declare an input that may or may not be reachable.

In Pathom, you can now do this using the new helper pco/? around some attribute at the input definition. To learn more check the new optional inputs section in Pathom docs.

Resolver prioritization

Pathom allows the graph to have multiple options to reach some attribute.

Now Pathom supports a new concept of resolver prioritization. You can define a priority number for a resolver, using the key ::pco/priority. For example:

(pco/defresolver run-me-first []
  {::pco/priority 1}
  {:x 42})

(pco/defresolver other-option []
  {:x 84})

(p.eql/process (pci/register [other-option run-me-first])
; => 42

The default priority when unassigned value is zero.

You can find the details at:

Nested inputs

Nested inputs are a new big deal. They allow for specific attributes to depend on nested shapes.

The most straightforward use for this is for doing aggregations that depend on derived data.

You can find an example at nested inputs documentation.

This will also be useful in optimizing dynamic resolvers even further, considering nested requirements from (possibly) flat attributes.


Caching got its own new documentation page.

Most features are the same as Pathom 2.

A new addition is support to configure a custom cache key per resolver. This makes easy to have different caches with different lifecycles for other resolvers.


Plugins support landed on Pathom 3!

The plugin support is similar to the one in Pathom 2, when you work by wrapping parts of the Pathom process.

There is a documentation page describing this process in more details. On this same page, you can also see the list of all currently available extensions.


I think Pathom is getting close to a first official release. For the first release, you can expect the API to be stable, with no breaking changes. At the same time, please remember this library did only “lab testing” so far (no production app that I know is using Pathom 3).

That said, these are the next milestones I’m going for next:

Async Process

In the JS world, most API related operations require some async process. So without this Pathom is limited in JS environments.

So I’ll tackle this next, to expand Pathom 3 possibilities in this space.

Tooling & Troubleshoot

Those two concepts are side by side. When a problem happens, tools can greatly help.

The idea is to upgrade the current Pathom Viz app also to support Pathom 3, some tools will be the same (like the query editor), and others may be completely new for Pathom 3.

Datomic Integration

The datomic integration is the time to give a fresh look into dynamic resolvers.

The dynamic support is something that needs upgrade. A lot changed in Pathom 3 since I ported the code. The datomic integration is the first milestone to get dynamic resolvers back on their feet in Pathom 3.

The work here is both Datomic and to start a more user-friendly API to deal with dynamic resolvers in Pathom 3.

GraphQL Integration

Then it’s time to reach for GraphQL again. A second evolution step on the user API for dynamic resolvers.

That’s it for today. See you at the next one!

Follow closer

If you like to know in more details about my projects check my open Roam database where you can see development details almost daily.

Support my work

I'm currently an independent developer and I spent quite a lot of my personal time doing open-source work. If my work is valuable for you or your company, please consider supporting my work though Patreon, this way you can help me have more available time to keep doing this work. Thanks!

Current supporters

And here I like to give a thanks to my current supporters:

Albrecht Schmidt
Austin Finlinson
Daemian Mack
Kendall Buchanan
Mark Wardle
Michael Glaesemann
Oleg, Iar, Anton