pathom

mjhika 2025-03-11T02:50:20.065029Z

If i'm wrapping API endpoints, is it more common or better to fully qualify all the keys deeply, or is it better to wrap the return in a fully qualified map for custom resolvers? i.e. is it better that my resolver return

::pco/output [{:fq/users [:id {:profile [:username :displayName}]}]
::pco/output [:fq/users]
or
::pco/output [{:fq/users [:fq.user/id {:fq.user/profile [:fq.user.profile/username :fq.user.profile/displayName}]}]
or is it better to only return the specific fields i'm interested in would return something like =>
[
 {
  "id": 1,
  "profile":
    {
     "username": "user.01",
     "displayName": "John Doe"
    }
  },
 {
  "id": 2,
  "profile":
    {
     "username": "user.02",
     "displayName": "Jane Doe"
    }
  },
 {
  "id": 3,
  "profile":
    {
     "username": "user.03",
     "displayName": "Jim Bo"
    }
  }
]  

mjhika 2025-03-12T21:02:57.442979Z

If i can add to the question, is the recommendation to fully qualify the keys in a nesting and concatenating manner or is like the examples from the docs just fine for most apps?

[:fq.user/id {:fq.user/profile [:fq.user.profile/displayName]}]

or

[:fq/id {:fq/profile [:fq/displayName]}]

wilkerlucio 2025-03-13T14:00:57.836929Z

the former is preferred (with the entity type in the ns). one way to think about it: as your system grows, you gonna want to reference those attributes for extension, a good name is one that can represent a semantic idea without conflicting with other names in your system

wilkerlucio 2025-03-13T14:02:18.269509Z

maybe :fq.user.profile/displayName isn't necessary, does the profile really needs to be mapped as some other entity? other options would be: :fq.user/display-name - just keep using the user :fq.profile/display-name - use profile, but no need to make it a sub-thing of the user. Unless you have multiple types of profiles in the system, in that case you may want to keep using :fq.user.profile

wilkerlucio 2025-03-13T14:02:22.274339Z

makes sense?

dehli 2025-03-11T09:57:35.660149Z

It comes to personal preference however I would prefer to fully qualify everything. This would allow other resolvers/mutations that interact and use those same concepts to utilize the same fully qualified keyword so it's clear to the consumer which type of username, display name, etc. you're dealing with

wilkerlucio 2025-03-11T11:13:24.838159Z

yes, using qualified names are preferred, so you can distinctively reference them later

mjhika 2025-03-11T21:07:46.725089Z

okay, i had a feeling that was the case. i guess more detail more better for the planner. that makes sense

mjhika 2025-03-11T21:07:51.731779Z

ty both

mjhika 2025-03-15T02:42:57.775479Z

oh okay yeah that makes sense! that clears up the right amount of detail that I should be shooting for. I was thinking maybe i was going too far with the nested data because I was getting some rather large pco/output values with some of these APIs and I was thinking maybe it was unnecessary, but I see where the detail can help as the system grows larger