        "\n")) ;; TODO: add description for parameters
 
 (defn generate-args
-  "Given a list of parameter maps and the parameterOrder vector,
-  generates the arguments vector.
+  "Given a method model, uses a list of parameter maps and the parameterOrder vector,
+  to generate the arguments vector.
   If the request is not nil, then the method also takes a request object,
   that gets specified as the first parameter."
-  [parameters parameterOrder request]
+  [{parameters :parameters
+    parameter-order :parameterOrder
+    request :request}]
   (let [[required optional] (->> parameters
                                  split-required-params
                                  (mapv (comp (partial mapv ->kebab-case-symbol) keys)))
-        ;; parameterOrder also contains the required params, so we get them from there
-        required (mapv ->kebab-case-symbol parameterOrder)
+        ;; parameter-order also contains the required params, so we get them from there
+        required (mapv ->kebab-case-symbol parameter-order)
         request-sym (when request
                       (->kebab-case-symbol (get request :$ref)))
         required (if request-sym

            [camel-snake-kebab.core :refer :all]))

(defn generate-ns-declaration
  "Generates the ns declaration for an API.
  Takes name, version, description and docs link, all strings."
  [name version desc docs-link]
  `(~'ns
    ~(symbol (str "gogolica." name "." version)) ;; HACK: instead of having the ns as string, we should probably read it from the current one
    ~(str desc "\n\nDocumentation link: " docs-link)
    (:gen-class)
    (:require [gogolica.common :refer [~'?assoc ~'exec-http] :as ~'common]
              [clojure.string :as ~'str])))

;; TODO move util generation to another function or a dedicated namespace
(defn generate-global-vars
  "Generates global variables that are used throughout the generated namespace"
  [root-url service-path]
  `[(def ~'base-url ~(str root-url service-path))])

(defn split-required-params

(defn generate-request
  "Generates the request map to be passed to the http library.
  NB: uses the `base-url` symbol, it should be generated in the ns including the method."
  [{http-method :httpMethod
    path :path
    parameters :parameters}]
  (let [query-params (->> parameters
                          (filter (fn [[_ v]] (= (:location v) "query")))
                          (mapv   (fn [[k _]] (name k))))
