pathom

Jakub Holý (HolyJak) 2023-03-26T08:39:40.163669Z

How do you folks deal with optional outputs? Let’s say I have a Person entity with :person/spouse attribute, which has no value until the person actually gets a spouse. Do I need to make my resolvers to return :person/spouse nil instead of not having the attribute at all in such cases? It works as is but I get the ugly error logs > E 2023-03-26T08:36:35.028Z _rad.pathom3:- 31 - EQL query for :person/spouse cannot be resolved. Is it spelled correctly? Pathom error: {:com.wsscode.pathom3.error/cause :com.wsscode.pathom3.error/attribute-unreachable} which I’d rather not have in my log. Thank you!

nivekuil 2023-03-26T09:24:14.685749Z

yeah, explicitly return nil if you explicitly know the value is nothing

Jakub Holý (HolyJak) 2023-03-26T11:07:13.028289Z

Thank you!

caleb.macdonaldblack 2023-03-26T21:37:48.800829Z

Return ::pco/unknown-value instead of nil. Pathom will understand that the resolver was not able to provide that value. If your query requires that value, then pathom will try and find it another way. Or if it’s optional in the query, then you have no issues

👍 1
caleb.macdonaldblack 2023-03-26T21:38:43.610799Z

Pathom understands nil to be a valid result for that attribute if i recall

Jakub Holý (HolyJak) 2023-03-27T06:55:17.955409Z

wonderful, thank you!