Skip to content

Commit

Permalink
Intern Some Extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkiel committed May 1, 2022
1 parent 004de4d commit c91c884
Show file tree
Hide file tree
Showing 11 changed files with 711 additions and 339 deletions.
1 change: 0 additions & 1 deletion dev/blaze/dev.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
[clojure.repl :refer [pst]]
[clojure.spec.test.alpha :as st]
[clojure.tools.namespace.repl :refer [refresh]]
[criterium.core :refer [bench quick-bench]]
[java-time :as time]
[taoensso.timbre :as log])
(:import
Expand Down
6 changes: 5 additions & 1 deletion modules/fhir-structure/.clj-kondo/config.edn
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{:lint-as
{blaze.fhir.spec.type.macros/defcomplextype clojure.core/defrecord
{blaze.fhir.spec.type.macros/defprimitivetype clojure.core/deftype
blaze.test-util/with-system clojure.core/with-open}

:hooks
{:macroexpand
{blaze.fhir.spec.type.macros/defcomplextype macros/defcomplextype}}

:linters
{:unsorted-required-namespaces
{:level :error}
Expand Down
14 changes: 14 additions & 0 deletions modules/fhir-structure/.clj-kondo/macros.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(ns macros)


(defmacro defcomplextype
[name [& fields] & {:keys [fhir-type hash-num interned references field-serializers]
:or {interned false}}]
`(defrecord ~name [~@fields]
blaze.fhir.spec.type.protocols/FhirType
(~'-type [~'_])
(~'-interned [~'_] ~interned)
~(if references
`(~'-references [~'_]
~references)
`(~'-references [~'_]))))
4 changes: 2 additions & 2 deletions modules/fhir-structure/resources/data_readers.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
fhir/date blaze.fhir.spec.type/->Date
fhir/dateTime blaze.fhir.spec.type/->DateTime
fhir/time blaze.fhir.spec.type/->Time
fhir/code blaze.fhir.spec.type/tagged-literal->Code
fhir/code blaze.fhir.spec.type/code
fhir/oid blaze.fhir.spec.type/->Oid
fhir/id blaze.fhir.spec.type/->Id
fhir/markdown blaze.fhir.spec.type/->Markdown
Expand All @@ -17,7 +17,7 @@
fhir/uuid blaze.fhir.spec.type/->Uuid
fhir/xhtml blaze.fhir.spec.type/->Xhtml
fhir/Attachment blaze.fhir.spec.type/map->Attachment
fhir/Extension blaze.fhir.spec.type/map->Extension
fhir/Extension blaze.fhir.spec.type/extension
fhir/Coding blaze.fhir.spec.type/coding
fhir/CodeableConcept blaze.fhir.spec.type/codeable-concept
fhir/Quantity blaze.fhir.spec.type/map->Quantity
Expand Down
6 changes: 4 additions & 2 deletions modules/fhir-structure/src/blaze/fhir/spec/impl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,15 @@
:modifier :json
:spec-form
(case key
:fhir.json/Extension
(json-object-spec-form "extension" child-spec-defs)
:fhir.json/Coding
(json-object-spec-form "coding" child-spec-defs)
:fhir.json/CodeableConcept
(json-object-spec-form "codeable-concept" child-spec-defs)
:fhir.json/Meta
(json-object-spec-form "mk-meta" child-spec-defs)
(:fhir.json/Attachment
:fhir.json/Extension
:fhir.json/Quantity
:fhir.json/Period
:fhir.json/Identifier
Expand Down Expand Up @@ -641,14 +642,15 @@
:modifier :cbor
:spec-form
(case key
:fhir.cbor/Extension
(cbor-object-spec-form "extension" child-spec-defs)
:fhir.cbor/Coding
(cbor-object-spec-form "coding" child-spec-defs)
:fhir.cbor/CodeableConcept
(cbor-object-spec-form "codeable-concept" child-spec-defs)
:fhir.cbor/Meta
(cbor-object-spec-form "mk-meta" child-spec-defs)
(:fhir.cbor/Attachment
:fhir.cbor/Extension
:fhir.cbor/Quantity
:fhir.cbor/Period
:fhir.cbor/Identifier
Expand Down
Loading

0 comments on commit c91c884

Please sign in to comment.