   (let [key (some-> ast :key)]
     (if (sequential? key) (second key))))
 
-(defn ensure-attrs [env attributes]
+(defn ensure-attrs
   "DEPRECATED: use p/entity
   Runs the parser against current element to garantee that some fields are loaded.
   This is useful when you need to ensure some values are loaded in order to fetch some
   more complex data."
+  [env attributes]
   (entity env attributes))

    #{}
    children))

(defn deep-merge [& xs]
  "Merges nested maps without overwriting existing keys."
  (if (every? #(or (map? %) (nil? %)) xs)
    (apply merge-with deep-merge xs)
    (last xs)))

  [query-expr]
  (-> (query->ast query-expr) :children first))

(defn ast->query
  "Given an AST convert it back into a query expression."
  [query-ast]
  (pp/ast->expr query-ast true))

(defn filter-ast [f ast]
