diff --git a/src/nl/surf/eduhub_rio_mapper/specs/common.clj b/src/nl/surf/eduhub_rio_mapper/specs/common.clj index a3799123..d96666c1 100644 --- a/src/nl/surf/eduhub_rio_mapper/specs/common.clj +++ b/src/nl/surf/eduhub_rio_mapper/specs/common.clj @@ -77,6 +77,10 @@ (s/keys :req-un [::LanguageTypedString/language ::LanguageTypedString/value])) +(s/def ::LanguageTypedStringUnlimited + (s/keys :req-un [::LanguageTypedString/language + string?])) + (s/def ::LanguageTypedStringNL/language #{"nl-NL" "nl-BE"}) @@ -107,6 +111,10 @@ (s/def ::LanguageTypedStrings (s/coll-of ::LanguageTypedString)) +;; A collection of language typed strings with any set of languages +(s/def ::LanguageTypedStringsUnlimited + (s/coll-of ::LanguageTypedStringUnlimited)) + (s/def ::LongLanguageTypedString/language (re-spec #"^[a-z]{2,4}(-[A-Z][a-z]{3})?(-([A-Z]{2}|[0-9]{3}))?$")) diff --git a/src/nl/surf/eduhub_rio_mapper/specs/program.clj b/src/nl/surf/eduhub_rio_mapper/specs/program.clj index e45554ef..fefd5398 100644 --- a/src/nl/surf/eduhub_rio_mapper/specs/program.clj +++ b/src/nl/surf/eduhub_rio_mapper/specs/program.clj @@ -26,7 +26,7 @@ (text-spec 1 40)) (s/def ::acceleratedRoute enums/acceleratedRoute) -(s/def ::admissionRequirements ::common/LanguageTypedStrings) +(s/def ::admissionRequirements ::common/LanguageTypedStringsUnlimited) (s/def ::assessment ::common/LanguageTypedStrings) (s/def ::children (s/coll-of ::common/uuid)) (s/def ::consentParticipationSTAP enums/consentParticipationSTAP) diff --git a/test/nl/surf/eduhub_rio_mapper/ooapi/program_test.clj b/test/nl/surf/eduhub_rio_mapper/ooapi/program_test.clj index 0783cfae..28d8969b 100644 --- a/test/nl/surf/eduhub_rio_mapper/ooapi/program_test.clj +++ b/test/nl/surf/eduhub_rio_mapper/ooapi/program_test.clj @@ -54,6 +54,11 @@ (let [{::s/keys [problems]} (s/explain-data ::prg/rio-consumer (assoc rio-consumer :educationOffererCode "123B123"))] (is (= :educationOffererCode (-> problems first :path first))))) +(deftest dont-validate-admission-reqs + (let [{::s/keys [problems]} (s/explain-data ::prg/program (assoc-in program [:admissionRequirements 0 :value] + (apply str (take 1010 (repeatedly #(char (+ (rand-int 26) 97)))))))] + (is (contains? #{nil []} problems)))) + (deftest validate-consumers (let [{::s/keys [problems]} (s/explain-data ::prg/consumers [other-consumer rio-consumer])] (is (contains? #{nil []} problems))))