Skip to content

Commit 76c9a8a

Browse files
committed
fix: generate List as FhirList class
1 parent 4360531 commit 76c9a8a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/aidbox_sdk/generator/python.clj

+6-3
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,16 @@
4848
(defn url->resource-name [reference]
4949
(last (str/split (str reference) #"/")))
5050

51+
(defn class-alias [class-name]
52+
(get {"List" "FhirList"} class-name class-name))
53+
5154
(defn class-name
5255
"Generate class name from schema url."
5356
[url]
5457
(-> url
5558
url->resource-name
56-
uppercase-first-letter
57-
(str/replace #"-" "_")))
59+
->pascal-case
60+
class-alias))
5861

5962
(defn generate-deps [deps]
6063
(->> deps
@@ -290,7 +293,7 @@
290293
:content (generate-module
291294
:deps (concat [{:module "typing" :members ["Optional" "List"]}
292295
{:module "dataclasses" :members ["dataclass"]}]
293-
(map (fn [d] {:module "base" :members [d]})
296+
(map (fn [d] {:module "base" :members [(class-alias d)]})
294297
(:deps ir-schema)))
295298
:classes [(generate-class ir-schema
296299
(map generate-class (:backbone-elements ir-schema)))])})

0 commit comments

Comments
 (0)