Skip to content

Commit

Permalink
Merge pull request #85 from yetanalytics/empty-lang-maps
Browse files Browse the repository at this point in the history
Empty language maps
  • Loading branch information
kelvinqian00 committed May 20, 2024
2 parents 84e2199 + 56123ef commit 5869bf7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
/resources/public/xapi_schema.js
.specljs-timestamp
/.cpcache
/.calva
/.clj-kondo
/.lsp
2 changes: 1 addition & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You can use xapi-schema to validate (and generate) statements in real-time [[htt
** Getting Started
1. Add to your project dependencies:
#+BEGIN_SRC clojure
[[com.yetanalytics/xapi-schema "1.2.1"]]
[[com.yetanalytics/xapi-schema "1.3.0"]]
#+END_SRC
2. Require in your project:
#+BEGIN_SRC clojure
Expand Down
6 changes: 1 addition & 5 deletions src/xapi_schema/spec.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,7 @@
(s/def ::language-map
(s/map-of ::language-tag
::language-map-text
:gen-max 3
;; Technically, empty language maps are allowed under the xAPI spec.
;; However, they are nonsensical in most contexts and will not
;; work in downstream libs (e.g those that use DynamoDB).
:min-count 1))
:gen-max 3))


(defn into-str [cs]
Expand Down
6 changes: 2 additions & 4 deletions test/xapi_schema/spec_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@
{"en-US" "foo"}
{"es" "hola mundo"}
{"zh-cmn" "你好世界"}
{} ; empty lang maps are allowed by spec
:bad
{"hey there" "foo"}
{"en" 2}
;; We do not allow for empty maps (despite technically
;; being spec-conformant)
{})))
{"en" 2})))

(deftest iri-test
(testing "must be a valid url with scheme"
Expand Down

0 comments on commit 5869bf7

Please sign in to comment.