From 8274cad48285dc39858bdecb9a5c8fdc95f6e2bf Mon Sep 17 00:00:00 2001 From: Vitaly Kravtsov Date: Thu, 26 Sep 2024 23:53:23 +0600 Subject: [PATCH] fix: python's deps generation after updating converter --- src/aidbox_sdk/generator/python.clj | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/aidbox_sdk/generator/python.clj b/src/aidbox_sdk/generator/python.clj index 19b82a1..75aaf00 100644 --- a/src/aidbox_sdk/generator/python.clj +++ b/src/aidbox_sdk/generator/python.clj @@ -293,12 +293,13 @@ (generate-resource-module [_ ir-schema] {:path (resource-file-path ir-schema) :content (generate-module - :deps (concat [{:module "typing" :members ["Optional" "List"]} - {:module "dataclasses" :members ["dataclass", "field"]}] - (map (fn [d] {:module "base" :members [(class-alias d)]}) - (:deps ir-schema))) - :classes [(generate-class ir-schema - (map generate-class (:backbone-elements ir-schema)))])}) + :deps (concat [{:module "typing" :members ["Optional" "List"]} + {:module "dataclasses" :members ["dataclass", "field"]}] + (->> (:deps ir-schema) + (map ->pascal-case) + (map (fn [d] {:module "base" :members [d]})))) + :classes [(generate-class ir-schema + (map generate-class (:backbone-elements ir-schema)))])}) (generate-search-params [_ ir-schemas] (map (fn [ir-schema] @@ -321,12 +322,14 @@ (mapv (fn [[constraint-name schema]] {:path (constraint-file-path schema constraint-name) :content (generate-module - :deps (concat [{:module "typing" :members ["Optional" "List"]} - {:module "dataclasses" :members ["dataclass", "field"]} - #_{:module "pydantic" :members ["*"]}] - (map (fn [d] {:module (str "..base." d) :members [d]}) (:deps schema))) - :classes (generate-class (assoc schema :url constraint-name) - (map generate-class (:backbone-elements schema))))}) + :deps (concat [{:module "typing" :members ["Optional" "List"]} + {:module "dataclasses" :members ["dataclass", "field"]} + #_{:module "pydantic" :members ["*"]}] + (->> (:deps schema) + (map ->pascal-case) + (map (fn [d] {:module "base" :members [d]})))) + :classes (generate-class (assoc schema :url constraint-name) + (map generate-class (:backbone-elements schema))))}) constraint-ir-schemas)) (generate-sdk-files [_] (generator/prepare-sdk-files :python)))