pathom

roklenarcic 2026-03-08T08:21:01.322579Z

How do I handle the situation when resolver either returns something or nothing? If I return nil from resolver (e.g. object requested doesn’t exist) I get an error:

Execution error (ExceptionInfo) at com.wsscode.pathom3.connect.runner/check-entity-requires! (runner.cljc:941).
Required attributes missing:

danieroux 2026-03-08T09:31:17.568359Z

Have a look at https://pathom3.wsscode.com/docs/error-handling/#lenient-mode

wilkerlucio 2026-03-08T16:07:01.046049Z

you can also make just that attribute optional

wilkerlucio 2026-03-08T16:08:29.229009Z

to keep in mind: if a resolver returns nil, its saying: I wasnt able to handle that request, so if there are other resolver options, try them while if return the attribute value as nil, eg {:foo nil}. them the resolver is saying: I know :foo is nil, dont look any further

wilkerlucio 2026-03-08T16:08:59.880589Z

and an unfulfilled value is an error, but a nil valued attribute isnt

roklenarcic 2026-03-08T16:11:34.184879Z

Thanks for explanation

roklenarcic 2026-03-08T16:12:15.987779Z

How do I mark attribute optional in output? Same as with inputs?

roklenarcic 2026-03-08T16:14:02.795199Z

I saw optional inputs in docs I didn't find optional outputs

wilkerlucio 2026-03-08T16:14:56.944829Z

you always do it at input level

wilkerlucio 2026-03-08T16:16:00.539479Z

outputs are by default expected to be optional, they are possibilites

wilkerlucio 2026-03-08T16:16:25.637409Z

but the decision about if an attribute is required or optional always comes from the part asking for it (that may be a resolver input, or your main query)

wilkerlucio 2026-03-08T16:17:04.101319Z

so, in your query, you can have something like: [:foo (pco/? :bar)], so you require foo, and would like :bar, but its ok if that cant be realized

wilkerlucio 2026-03-08T16:18:09.035669Z

the idea is this design is to maximize the utility of attributes, and leave requirements to be as close as possible of when they are used

roklenarcic 2026-03-08T16:47:43.407579Z

Ok that’s interesting