mirror of
https://github.com/metosin/reitit.git
synced 2025-12-16 16:01:11 +00:00
chore: update openapi-schema-validator, fix test
validator now disallows having both "example" and "examples"
This commit is contained in:
parent
defebb0f1f
commit
c684c83c99
3 changed files with 576 additions and 278 deletions
840
package-lock.json
generated
840
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "reitit",
|
"name": "reitit",
|
||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@seriousme/openapi-schema-validator": "^2.4.0",
|
"@seriousme/openapi-schema-validator": "^2.7.0",
|
||||||
"karma": "^6.4.4",
|
"karma": "^6.4.4",
|
||||||
"karma-chrome-launcher": "^3.2.0",
|
"karma-chrome-launcher": "^3.2.0",
|
||||||
"karma-cli": "^2.0.0",
|
"karma-cli": "^2.0.0",
|
||||||
|
|
|
||||||
|
|
@ -901,13 +901,11 @@
|
||||||
:request {:description "body description"
|
:request {:description "body description"
|
||||||
:content {"application/json" {:schema {:x int?, :y int?}
|
:content {"application/json" {:schema {:x int?, :y int?}
|
||||||
:examples {"1+1" {:value {:x 1, :y 1}}
|
:examples {"1+1" {:value {:x 1, :y 1}}
|
||||||
"1+2" {:value {:x 1, :y 2}}}
|
"1+2" {:value {:x 1, :y 2}}}}}}
|
||||||
:openapi {:example {:x 2, :y 2}}}}}
|
|
||||||
:responses {200 {:description "success"
|
:responses {200 {:description "success"
|
||||||
:content {"application/json" {:schema {:total int?}
|
:content {"application/json" {:schema {:total int?}
|
||||||
:examples {"2" {:value {:total 2}}
|
:examples {"2" {:value {:total 2}}
|
||||||
"3" {:value {:total 3}}}
|
"3" {:value {:total 3}}}}}}}
|
||||||
:openapi {:example {:total 4}}}}}}
|
|
||||||
:handler (fn [request]
|
:handler (fn [request]
|
||||||
(let [{:keys [x y]} (-> request :parameters :body)]
|
(let [{:keys [x y]} (-> request :parameters :body)]
|
||||||
{:status 200, :body {:total (+ x y)}}))}}]]]
|
{:status 200, :body {:total (+ x y)}}))}}]]]
|
||||||
|
|
@ -925,16 +923,14 @@
|
||||||
:required [:x :y],
|
:required [:x :y],
|
||||||
:additionalProperties false},
|
:additionalProperties false},
|
||||||
:examples {"1+1" {:value {:x 1, :y 1}}
|
:examples {"1+1" {:value {:x 1, :y 1}}
|
||||||
"1+2" {:value {:x 1, :y 2}}},
|
"1+2" {:value {:x 1, :y 2}}}}}},
|
||||||
:example {:x 2, :y 2}}}},
|
|
||||||
:responses {200 {:description "success",
|
:responses {200 {:description "success",
|
||||||
:content {"application/json" {:schema {:type "object",
|
:content {"application/json" {:schema {:type "object",
|
||||||
:properties {:total {:type "integer"}},
|
:properties {:total {:type "integer"}},
|
||||||
:required [:total],
|
:required [:total],
|
||||||
:additionalProperties false},
|
:additionalProperties false},
|
||||||
:examples {"2" {:value {:total 2}},
|
:examples {"2" {:value {:total 2}},
|
||||||
"3" {:value {:total 3}}},
|
"3" {:value {:total 3}}}}}}},
|
||||||
:example {:total 4}}}}},
|
|
||||||
:summary "plus with body"}}}
|
:summary "plus with body"}}}
|
||||||
(:paths spec)))
|
(:paths spec)))
|
||||||
(is (nil? (validate spec))))
|
(is (nil? (validate spec))))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue