Skip to content

Commit d76cb59

Browse files
authored
Merge pull request #1151 from dekelpilli/tuple-json-schema
Update json-schema for :tuple for 2020-12 draft
2 parents 440de1b + e045f3d commit d76cb59

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/malli/json_schema.cljc

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150

151151
(defmethod accept :enum [_ _ children options] (merge (some-> (m/-infer children) (-transform options)) {:enum children}))
152152
(defmethod accept :maybe [_ _ children _] {:oneOf (conj children {:type "null"})})
153-
(defmethod accept :tuple [_ _ children _] {:type "array", :items children, :additionalItems false})
153+
(defmethod accept :tuple [_ _ children _] {:type "array", :prefixItems children, :items false})
154154
(defmethod accept :re [_ schema _ options] {:type "string", :pattern (first (m/children schema options))})
155155
(defmethod accept :fn [_ _ _ _] {})
156156

test/malli/json_schema_test.cljc

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@
9191
[[:enum 'kikka 'kukka] {:type "string" :enum ['kikka 'kukka]}]
9292
[[:maybe string?] {:oneOf [{:type "string"} {:type "null"}]}]
9393
[[:tuple string? string?] {:type "array"
94-
:items [{:type "string"} {:type "string"}]
95-
:additionalItems false}]
94+
:prefixItems [{:type "string"} {:type "string"}]
95+
:items false}]
9696
[[:re "^[a-z]+\\.[a-z]+$"] {:type "string", :pattern "^[a-z]+\\.[a-z]+$"}]
9797
[[:fn {:gen/elements [1]} int?] {}]
9898
[:any {}]
@@ -355,8 +355,8 @@
355355
:required [:id :malli.json-schema-test/location `description],
356356
:definitions {"malli.json-schema-test/UserId" {:type "string"},
357357
"malli.json-schema-test/location" {:type "array",
358-
:items [{:type "number"} {:type "number"}],
359-
:additionalItems false},
358+
:prefixItems [{:type "number"} {:type "number"}],
359+
:items false},
360360
"malli.json-schema-test/description" {:type "string"},
361361
"malli.json-schema-test/User" {:type "object",
362362
:properties {:id {:$ref "#/definitions/malli.json-schema-test~1UserId"},

0 commit comments

Comments
 (0)