Skip to content

Commit

Permalink
added schema-validation to swagger-validation, wrapped Options argume…
Browse files Browse the repository at this point in the history
…nts into Maybe
  • Loading branch information
ikitommi committed Apr 26, 2015
1 parent abdc2b9 commit 6c0ada0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ring/swagger/swagger2.clj
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@
:default-response-description-fn ((constantly \"\")) - a fn to generate
default response descriptions from http status code"
([swagger :- Swagger] (swagger-json swagger {}))
([swagger :- Swagger, options :- Options]
([swagger :- Swagger] (swagger-json swagger nil))
([swagger :- Swagger, options :- (s/maybe Options)]
(let [options (merge option-defaults options)]
(binding [jsons/*ignore-missing-mappings* (true? (:ignore-missing-mappings? options))
*options* options]
Expand Down
3 changes: 2 additions & 1 deletion test/ring/swagger/swagger2_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
(s/defschema NotFound {:message s/Str})

(defn validate-swagger-json [swagger & [options]]
(v/validate (swagger-json swagger options)))
(s/with-fn-validation
(v/validate (swagger-json swagger options))))

(defn validate [swagger & [options]]
(if-let [input-errors (s/check Swagger swagger)]
Expand Down

0 comments on commit 6c0ada0

Please sign in to comment.