Fork me on GitHub
#pathom
<
2021-07-28
>
cyppan08:07:11

In lenient mode, when I query a field with (pco/? :field) and the field is not returned by the resolver, I get an attribute error, but I would expect no error, the field should simply not be in the output (or do I miss something?)

👀 3
cyppan16:07:16

Do you have any doc or advice to start contributing ?

wilkerlucio17:07:41

no docs yet,but would be nice to have

wilkerlucio17:07:13

about this specific issue, I fixed already, but I left home and forgot to push :face_palm:, will push once I get back home in a few hours

🙂 3
wilkerlucio17:07:45

but I suggest you can start familiarizing with the namespaces and how the concepts are organized

wilkerlucio17:07:03

Im happy to go over any questiona you have on it

cyppan17:07:34

ok thanks I’ll follow your suggestion

cyppan14:07:13

Now I don’t have the errors when the attributes are declared in the resolver pco/output, but if they’re not, an EQL query with a (pco/? :undeclared-output-key) will add an attribute error :com.wsscode.pathom3.error/attribute-unreachable It forces me to declare all the possible output keys in my resolvers, which I wanted to avoid, is it a wanted behavior?

cyppan14:07:20

When I think about it the error is legit, what I would want actually is to declare the strict minimum in my resolvers, only some keys and what’s necessary for joins, but the rest would be fed from the resolver data when possible, a kind of a new kind pco/?, maybe a pco/try or something like that

cyppan14:07:18

> In lenient mode, an optional attribute missing on the index adds an error, it shouldn’t by “missing on the index” you mean it’s not available in a reachable pco/output right ? (Oh no this corresponds to the one just after it, I understand it’s in the case where there is no pco/output at all corresponding to this in any resolver in the env)

wilkerlucio16:07:46

missing on the index means there is no resolver that contains that attribute at the resolver output root level (nested levels have a different process)

thanks2 2
wilkerlucio16:07:00

I plan to tackle this issue today

👍 2
nivekuil22:07:05

in strict mode, when I request only an optional attribute, pathom will still throw. is that expected?

wilkerlucio23:07:14

example? and consider the comment I sent on the other message :)

nivekuil22:07:07

in general it seems if there isn't a path to an attribute it doesn't matter whether it's a pco/? or not

wilkerlucio23:07:14

in strict mode, exceptions will always flows up

wilkerlucio23:07:42

the exception is if the attribute has multiple options and only some of them fail, in this case it doesnt throw

wilkerlucio23:07:18

ah, yes, thats correct, in strict mode if you ask something not on the index, always a failure

wilkerlucio23:07:53

but this is not set in stone, thinking a bit more about it, maybe makes more sense to ignore that optional in case of absense

wilkerlucio23:07:12

I'm thinking that it should behave the same way in inputs and queries, and in inputs its not an exceptional thing if the attribute is not in the index at all (for optionals)

nivekuil03:07:02

at least my intuitive expectation is that if a requested attribute is optional, it should have no effect at all on the rest of the query, and all the processing steps done solely for its sake should be considered lenient, but I can see how that adds a lot of complexity to pathom

nivekuil03:07:38

not being able to find an optional attribute also adds an attribute error to lenient mode btw

wilkerlucio04:07:25

thanks for the input, I opened an issue, should address them soon: https://github.com/wilkerlucio/pathom3/issues/81