Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty language maps #85

Merged
merged 5 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading