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",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@seriousme/openapi-schema-validator": "^2.4.0",
|
||||
"@seriousme/openapi-schema-validator": "^2.7.0",
|
||||
"karma": "^6.4.4",
|
||||
"karma-chrome-launcher": "^3.2.0",
|
||||
"karma-cli": "^2.0.0",
|
||||
|
|
|
|||
|
|
@ -901,13 +901,11 @@
|
|||
:request {:description "body description"
|
||||
:content {"application/json" {:schema {:x int?, :y int?}
|
||||
:examples {"1+1" {:value {:x 1, :y 1}}
|
||||
"1+2" {:value {:x 1, :y 2}}}
|
||||
:openapi {:example {:x 2, :y 2}}}}}
|
||||
"1+2" {:value {:x 1, :y 2}}}}}}
|
||||
:responses {200 {:description "success"
|
||||
:content {"application/json" {:schema {:total int?}
|
||||
:examples {"2" {:value {:total 2}}
|
||||
"3" {:value {:total 3}}}
|
||||
:openapi {:example {:total 4}}}}}}
|
||||
"3" {:value {:total 3}}}}}}}
|
||||
:handler (fn [request]
|
||||
(let [{:keys [x y]} (-> request :parameters :body)]
|
||||
{:status 200, :body {:total (+ x y)}}))}}]]]
|
||||
|
|
@ -925,16 +923,14 @@
|
|||
:required [:x :y],
|
||||
:additionalProperties false},
|
||||
:examples {"1+1" {:value {:x 1, :y 1}}
|
||||
"1+2" {:value {:x 1, :y 2}}},
|
||||
:example {:x 2, :y 2}}}},
|
||||
"1+2" {:value {:x 1, :y 2}}}}}},
|
||||
:responses {200 {:description "success",
|
||||
:content {"application/json" {:schema {:type "object",
|
||||
:properties {:total {:type "integer"}},
|
||||
:required [:total],
|
||||
:additionalProperties false},
|
||||
:examples {"2" {:value {:total 2}},
|
||||
"3" {:value {:total 3}}},
|
||||
:example {:total 4}}}}},
|
||||
"3" {:value {:total 3}}}}}}},
|
||||
:summary "plus with body"}}}
|
||||
(:paths spec)))
|
||||
(is (nil? (validate spec))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue