   [sym type node-type bindings & body]
   `(def ~sym (nodevisitor ~type ~node-type ~bindings ~@body)))
 
-(defn initial-state [schema]                                ;; TODO extract to validator
+(defn initial-state [schema]
   (let [{:keys [mutation-type] :as schema-definition} (schema-definition schema)
         schema-definition (or schema-definition {:node-type :schema-definition :query-type {:name "Query"}})
         root-query-name   (get-in schema-definition [:query-type :name])

           (filter #(= :schema-definition (:node-type %)))
           first))

(defn- upsert-schema-entrypoint ;; TODO extract to validator
  [type-system-definitions root-query-name]
  (let [grouped (group-by #(= root-query-name (:type-name %)) type-system-definitions)
        entrypoint (intro/upsert-root-query (first (get grouped true)) root-query-name)

        (assoc :state (-> result :document section :state))
        (update-in [:document section] dissoc :state))))

(defn- schema-definition
  "Given a parsed schema document, return the schema definition that defines the entry point
   types (schema and optionally mutation). Can return nil, in which case the default type
   `Query` will be used and mutations will be disabled."
