wilkerlucio / pathom3

Interface with complex data via graph mapping.
https://pathom3.wsscode.com
Eclipse Public License 2.0
376 stars 31 forks source link

API namespace #100

Closed lgrapenthin closed 3 years ago

lgrapenthin commented 3 years ago

I'd like to learn more about this project. However I can't continue, because the documentation says:

When you read code from the examples in this documentation they will use alias to reference namespaces, here you can find what the aliases point to:

[com.wsscode.pathom3.cache :as p.cache] [com.wsscode.pathom3.connect.built-in.resolvers :as pbir] [com.wsscode.pathom3.connect.built-in.plugins :as pbip] [com.wsscode.pathom3.connect.foreign :as pcf] [com.wsscode.pathom3.connect.indexes :as pci] [com.wsscode.pathom3.connect.operation :as pco] [com.wsscode.pathom3.connect.operation.transit :as pcot] [com.wsscode.pathom3.connect.planner :as pcp] [com.wsscode.pathom3.connect.runner :as pcr] [com.wsscode.pathom3.error :as p.error] [com.wsscode.pathom3.format.eql :as pf.eql] [com.wsscode.pathom3.interface.async.eql :as p.a.eql] [com.wsscode.pathom3.interface.eql :as p.eql] [com.wsscode.pathom3.interface.smart-map :as psm] [com.wsscode.pathom3.path :as p.path] [com.wsscode.pathom3.plugin :as p.plugin]

This problem could be solved by an API namespace.

wilkerlucio commented 3 years ago

Hello, this is a complete list of all the namespaces you might use, but usually, you only need a few of them. The problem with an API namespace is that it will end up requiring many things you don't need, adding to start time. This was a problem in Pathom 2 and that's the reason to get things separate in Pathom 3.

In reality, you can do a lot with just 3 of those:

; this one to create resolvers and mutations
[com.wsscode.pathom3.connect.operation :as pco]
; this one is to register resolvers, creating the indexes
[com.wsscode.pathom3.connect.indexes :as pci]

; then to setup EQL processor you will use:
[com.wsscode.pathom3.interface.eql :as p.eql]
; OR, in case you use async, gonna be this instead:
[com.wsscode.pathom3.interface.async.eql :as p.a.eql]

These will cover most of the standard Pathom operations, in projects that are more than demos, usually, you gonna use pco in a lot of places to define resolvers, while the indexes and operation you will have in a single place to start the register and set up the EQL processor.

You are welcome to set up your own API namespace as well if you like to concentrate the things in a single namespace. So I don't consider this an issue at the library level.

lgrapenthin commented 3 years ago

Maybe some spec style "dynaload" would help with the start time. Alternating between unfamiliar namespaces while learning a new library is annoying and adds unnecessary overhead. I'll be waiting for a better experience.