Skip to content

Commit

Permalink
url->resource-name for urls with version
Browse files Browse the repository at this point in the history
  • Loading branch information
krvital committed Sep 19, 2024
1 parent 684ef82 commit 55c89b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/aidbox_sdk/converter.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
(defn url->resource-name
"There are :id and :name in schemas but they are not reliable source."
[url]
(last (str/split (str url) #"/")))
(str/replace
(last (str/split (str url) #"/"))
#"\||\."
"-"))

(defn flatten-backbones [backbone-elements accumulator]
(reduce (fn [acc item]
Expand Down
3 changes: 2 additions & 1 deletion test/aidbox_sdk/converter_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"iso21090-ADXP-deliveryAddressLine"
(sut/url->resource-name "http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-deliveryAddressLine")

(sut/url->resource-name "http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-deliveryAddressLine"))))
"us-core-patient-6-0-0"
(sut/url->resource-name "http://hl7.org/fhir/us/core/structuredefinition/us-core-patient|6.0.0"))))

(deftest test-resolve-references
(is (= fixtures/schemas-with-element-reference-resolved
Expand Down

0 comments on commit 55c89b5

Please sign in to comment.