Skip to content

Commit

Permalink
add resource-name to IR schema
Browse files Browse the repository at this point in the history
  • Loading branch information
krvital committed Sep 26, 2024
1 parent 6409d90 commit 157aac8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/aidbox_sdk/converter.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
(:require
[aidbox-sdk.fhir :as fhir]
[aidbox-sdk.generator.helpers :refer [->pascal-case safe-conj
words
uppercase-first-letter vector->map]]
[clojure.set :as set]
[clojure.string :as str]
Expand All @@ -12,10 +13,12 @@
(defn url->resource-name
"There are :id and :name in schemas but they are not reliable source."
[url]
(str/replace
(last (str/split (str url) #"/"))
#"\||\."
"-"))
(str/join "-"
(words
(str/replace
(last (str/split (str url) #"/"))
#"\||\."
"-"))))

(defn flatten-backbones [backbone-elements accumulator]
(reduce (fn [acc item]
Expand Down Expand Up @@ -144,6 +147,7 @@
(url->resource-name (:url schema)))
(safe-conj
(hash-map :base (get schema :base)
:resource-name (url->resource-name (get schema :url))
:base-resource-name (when (get schema :base)
(url->resource-name (get schema :base)))
:package (get schema :package)
Expand Down

0 comments on commit 157aac8

Please sign in to comment.