Skip to content

Commit

Permalink
Standardize naming convention for entries + fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
respatialized committed Dec 12, 2024
1 parent 45c1e38 commit b22f505
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
org.clojure/test.check {:mvn/version "1.1.1"}
site.fabricate/manual
{:git/url "https://github.com/fabricate-site/manual.git"
:sha "67e02b757d06d90761978f5e37504ff900778b83"}}
:sha "0285311b5517b806dca43360235bc0fff4970728"}}
:extra-paths ["test"]}
:validate {:exec-args {:dirs ["docs/"]}
:exec-fn site.fabricate.prototype.check/html}}
Expand Down
8 changes: 4 additions & 4 deletions src/site/fabricate/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@
:site.fabricate.page/modified-time :site.fabricate.page/tags
:site.fabricate.entry/id :site.fabricate.entry/namespace]))
;; entries ultimately have to come from somewhere.
[:site.fabricate.entry/source :site.fabricate.source/location
[:site.fabricate.api/source :site.fabricate.source/location
:site.fabricate.source/format]))


(defn collect-dispatch
"Equivalent to a multi-arg version of `clojure.core/identity` for a source."
{:malli/schema (m/schema [:=> [:cat :site.fabricate.entry/source :map]
:site.fabricate.entry/source])
{:malli/schema (m/schema [:=> [:cat :site.fabricate.api/source :map]
:site.fabricate.api/source])
:private true}
[src options]
src)
Expand All @@ -143,7 +143,7 @@
A site is the primary map passed between the 3 core API functions: plan!, assemble, and construct!"
(m/schema [:map [:site.fabricate.api/entries [:* entry-schema]]
[:site.fabricate.api/options [:map-of :any :any]]]))
[:site.fabricate.api/options :map]]))

(def site-fn-schema
"Function schema for functions that operate on a site"
Expand Down
12 changes: 5 additions & 7 deletions test/site/fabricate/api_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

(def api-contracts
(let [entry-schema
[:map [:site.fabricate.entry/source :site.fabricate.entry/source]
[:map [:site.fabricate.api/source :site.fabricate.api/source]
[:site.fabricate.source/location :site.fabricate.source/location]
[:site.fabricate.page/output {:optional true}
:site.fabricate.page/output]
Expand Down Expand Up @@ -127,8 +127,7 @@
[:map
[:site.fabricate.api/entries
[:*
[:map
[:site.fabricate.entry/source :site.fabricate.entry/source]
[:map [:site.fabricate.api/source :site.fabricate.api/source]
[:site.fabricate.source/location
:site.fabricate.source/location]
[:site.fabricate.page/output {:optional true}
Expand Down Expand Up @@ -178,8 +177,7 @@
[:map
[:site.fabricate.api/entries
[:*
[:map
[:site.fabricate.entry/source :site.fabricate.entry/source]
[:map [:site.fabricate.api/source :site.fabricate.api/source]
[:site.fabricate.source/location
:site.fabricate.source/location]
[:site.fabricate.page/output {:optional true}
Expand Down Expand Up @@ -226,8 +224,8 @@
:site.fabricate.entry/namespace]]]]
[:site.fabricate.api/options :map]]]]}}
:site.fabricate.api/site-fn]]
{#'api/collect (m/schema [:=> [:cat :site.fabricate.entry/source :map]
:site.fabricate.entry/source])
{#'api/collect (m/schema [:=> [:cat :site.fabricate.api/source :map]
:site.fabricate.api/source])
#'api/plan! site-fn-schema
#'api/build (m/schema [:=> [:cat entry-schema :map]
[:tuple :site.fabricate.source/format
Expand Down

0 comments on commit b22f505

Please sign in to comment.