From 3688da20ed2a52169b5e1e6d4fafa6bf5d08c990 Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Sun, 26 Apr 2015 11:28:21 +0300 Subject: [PATCH] polish README, bump up version --- CHANGELOG.md | 3 ++- README.md | 54 +++++++++++++++++++++++++++++++++------------------- project.clj | 2 +- 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25193739..a2a51c5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ -## x.xx.x +## 0.20.1 (26.4.2015) +- `swagger-json` now handles `nil` options, thanks to [Frankie Sardo](https://github.com/frankiesardo). - updated dependencies: ```clojure [prismatic/schema "0.4.1"] is available but we use "0.4.0" diff --git a/README.md b/README.md index 88af444c..1efedd4a 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,7 @@ - [pedastal-swagger](https://github.com/frankiesardo/pedestal-swagger) for Pedastal - [rook](https://github.com/AvisoNovate/rook) -Route definitions as expected as a clojure Map defined by the [Schema](https://github.com/metosin/ring-swagger/blob/master/src/ring/swagger/swagger2_schema.clj). -The Schema is open as ring-swagger tries not to be on your way - one can always pass any extra data in the Swagger Spec format. The generated specs can be validated against -the [Swagger Schema](https://raw.githubusercontent.com/reverb/swagger-spec/master/schemas/v2.0/schema.json) via tools like -[scjsv](https://github.com/metosin/scjsv). +Route definitions as expected as a clojure Map defined by the [Schema](https://github.com/metosin/ring-swagger/blob/master/src/ring/swagger/swagger2_schema.clj). The Schema is open as ring-swagger tries not to be on your way - one can always pass any extra data in the Swagger Spec format. ### Simplest possible example @@ -58,23 +55,38 @@ the [Swagger Schema](https://raw.githubusercontent.com/reverb/swagger-spec/maste :address {:street s/Str :city (s/enum :tre :hki)}}) -(rs/swagger-json {:info {:title "Cool API" - :contact {:email "my@example.com"}} - :tags [{:name "user" - :description "User stuff"}] - :paths {"/api/ping" {:get nil} - "/user/:id" {:post {:summary "User Api" - :description "User Api description" - :tags ["user"] - :parameters {:path {:id s/Str} - :body User} - :responses {200 {:schema User - :description "Found it!"} - 404 {:description "Ohnoes."}}}}}}) +(s/with-fn-validation + (rs/swagger-json + {:info {:version "1.0.0" + :title "Sausages" + :description "Sausage description" + :termsOfService "http://helloreverb.com/terms/" + :contact {:name "My API Team" + :email "foo@example.com" + :url "http://www.metosin.fi"} + :license {:name "Eclipse Public License" + :url "http://www.eclipse.org/legal/epl-v10.html"}} + :tags [{:name "user" + :description "User stuff"}] + :paths {"/api/ping" {:get nil} + "/user/:id" {:post {:summary "User Api" + :description "User Api description" + :tags ["user"] + :parameters {:path {:id s/Str} + :body User} + :responses {200 {:schema User + :description "Found it!"} + 404 {:description "Ohnoes."}}}}}})) ; {:swagger "2.0" -; :info {:title "Cool API" -; :version "0.0.1" -; :contact {:email "my@example.com"}} +; :info {:version "1.0.0" +; :title "Sausages" +; :description "Sausage description" +; :termsOfService "http://helloreverb.com/terms/" +; :contact {:email "foo@example.com" +; :name "My API Team" +; :url "http://www.metosin.fi"} +; :license {:name "Eclipse Public License" +; :url "http://www.eclipse.org/legal/epl-v10.html"}} ; :produces ["application/json"] ; :consumes ["application/json"] ; :paths {"/api/ping" {:get {:responses {:default {:description ""}}}} @@ -105,6 +117,8 @@ the [Swagger Schema](https://raw.githubusercontent.com/reverb/swagger-spec/maste ### validating the results +The generated full spec can be validated against the [Swagger JSON Schema](https://raw.githubusercontent.com/reverb/swagger-spec/master/schemas/v2.0/schema.json) via tools like [scjsv](https://github.com/metosin/scjsv). + ```clojure (require '[scjsv.core :as scjsv]) diff --git a/project.clj b/project.clj index a1f9575d..caf2a891 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject metosin/ring-swagger "0.20.0" +(defproject metosin/ring-swagger "0.20.1" :description "Swagger Spec for Ring Apps" :url "https://github.com/metosin/ring-swagger" :license {:name "Eclipse Public License"