 (def request-body-fields
   [:required])
 
-(defn transform-request-body-object [parameter-name parent-key data request-body-object-spec spec-type]
+(defn transform-request-body-object [request-body-key parent-key data request-body-object-spec spec-type]
   (if-let [ref (:$ref request-body-object-spec)]
     (-> data
         (update-in [:references] conj {:source-path parent-key :target-path ref}))
-    (let [key (str parent-key "/" parameter-name)]
-      (-> data
-          (update-in [:swagger-object key] assoc :name parameter-name)
+    (let [key (str parent-key "/" (name request-body-key))]
+      (-> data
+          (update-in [:swagger-object key] assoc :name (name request-body-key))
           (update-in [:swagger-object key] assoc :type spec-type)
           (update-in [:swagger-object key] assoc :parent parent-key)
           (update-in [:swagger-object key] assoc :description (common/render-resource-strings "templates/request-body-object.tpl" request-body-object-spec request-body-fields))

   :explode
   :allowReserved])

(defn transform-encoding-object [parameter-name parent-key data encoding-object-spec spec-type]
  (let [key (str parent-key "/" parameter-name)]
    (-> data
        (update-in [:swagger-object key] assoc :name parameter-name)
        (update-in [:swagger-object key] assoc :type spec-type)
        (update-in [:swagger-object key] assoc :parent parent-key)
        (update-in [:swagger-object key] assoc :description (common/render-resource-strings "templates/encoding-object.tpl" encoding-object-spec encoding-table-fields))

        (transform-objects transform-response-object (:responses operation-object-spec) key :OpenAPI-Response))))


(defn transform-path-object [path-key parent-key data path-object-spec spec-type]
  (let [key (str parent-key "/" (name path-key))
        data (-> data
                 (update-in [:swagger-object key] assoc :name (subs (str path-key) 1))
                 (update-in [:swagger-object key] assoc :type :OpenAPI-Path)
                 (update-in [:swagger-object key] assoc :parent parent-key)
                 (update-in [:swagger-object key] assoc :description (common/render-resource-strings "templates/path-object.tpl" path-object-spec))
                 (transform-objects transform-operation-object (select-keys path-object-spec [:get :put :post :delete :options :head :patch :trace]) key :OpenAPI-Operation)
                 (transform-objects transform-parameter-object (:parameters path-object-spec) key :OpenAPI-Parameter))]
    (if-let [ref (:$ref path-object-spec)]
      (-> data
          (update-in [:references] conj {:source-path key :target-path ref}))
      data)))


(defn transform-components-object [data spec]
