WSSCode Blog

Pathom Updates 11, Pathom 3 Alpha is out!

September 03, 2021

Almost a year ago, I announced Pathom 3.

Now it is here! Today I’m happy to announce that Pathom 3 alpha is released!

What alpha means?

The milestone here that marks the Alpha is that it has reached the features I had in mind for this stage. Let’s talk about those features.

First, the basics, Pathom 3 already covers almost all features of Pathom 2 (big exception is the parallel processor).

On top of that, we have long wanted features like Nested Inputs and Optional Inputs.

The most notorious recent feature is the support for Foreign Environments. When I did the Maximal Graph talk in the last conj. I talked about the vision to enable the automatic integration between multiple Pathom instances. This support just landed!

Please note that it is still early development stages. I’ve been playing with simple cases but between that and a reliable system, there are still many steps to take.

For more of that, check the Dynamic Resolvers section later in this article.

That said, for the basic features of Pathom 3, it seems things are already better than they were in Pathom 2.

A rule of thumb is to think that most features that were present in Pathom 2 lean on the stable side, while new features from Pathom 3 are in a more experimental stage.

Strict by default

Pathom was designed with high tolerance in mind. This means Pathom will try its best to return whatever it can to the user. Failures are as partial as possible.

This changes in Pathom 2021.07.19-alpha. Starting on this version, Pathom is now strict by default.

In practice:

  • Errors will surface earlier and clear
  • Users will be able to find mistakes and typos much faster
  • Now, Pathom users can express: “I want all of it, or nothing.”

Using this on my tests, I found this mode much more pleasing to develop with. This model avoids the previous issue that finding the errors was a big drag.

This doesn’t mean the tolerance features are gone. I believe the tolerant mode is an important mode that apps doing large queries still want to use.

This is now called lenient mode, and you can tell Pathom to work this way by setting the attribute :pathom/lenient-mode? true in the env:

(def env
  (-> {:pathom/lenient-mode? true}
      (pci/register ...)))

This is a breaking change. For the brave users already using Pathom 3, please try and see how the new strict mode works for you.

The attribute-errors-plugin is now deprecated. Using lenient mode will add attribute error data, like if you were using the plugin. If you were using the plugin, please remove it from your setup. The code for the plugin will be eventually removed.

Pathom Viz

Pathom Viz got some updates to support the new strict mode of Pathom 3. You can find that and other details at the changelog.

A big one that’s worth bringing here is the new entity data editor.

Entity Data Editor

In Pathom 2, users got used to idents as a way to provide a single point of data to start a query.

A common question was always: how to provide more than one attribute?

In Pathom 2, the answer is the :pathom/context on the idents, this way, you can offer extra attributes plus the ident one.

In Pathom 3, we support params in placeholders as a form to offer data.

Another way is that many constructs of Pathom 3 like the EQL processor, and the new boundary interface. This allows the user to set data at the root level of the query.

Now you can fulfill this root data at the new entity data editor:

This editor knows the Pathom attributes and offers auto-complete as you type to help fill it in.

Dynamic resolvers

Over the last month, I spent most of my Pathom time experimenting with dynamic resolvers.

The first big target for dynamic resolvers is the ability for a Pathom instance to integrate automatically with Pathom instances. This integration is called Foreign Environments and you can read more about it at https://pathom3.wsscode.com/docs/foreign.

To do it, I was playing with integrations with GraphQL and Datomic.

Docs on dynamic resolvers: https://pathom3.wsscode.com/docs/dynamic-resolvers

GraphQL Integration

Pathom 3 now can integrate with GraphQL using the new dynamic resolvers support!

There are tons of GraphQL APIs out there, and it’s likely they keep increasing.

This integration means Pathom users can reach and easily use all those resources.

You can find some initial docs about this integration at https://pathom3.wsscode.com/docs/integrations/graphql

Tutorials

In the previous period, we got two new Pathom 3 tutorials:

Next steps

I’m still working on some known bugs in the dynamic resolvers. After that, I’ll start working on the parallel processor.

Have a great day!


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
Alister Lee
Austin Finlinson
Daemian Mack
Jochen Bedersdorfer
Kendall Buchanan
Mark Wardle
Michael Glaesemann
Oleg, Iar, Anton
West