Skip to content

Commit

Permalink
polish README, bump up version
Browse files Browse the repository at this point in the history
  • Loading branch information
ikitommi committed Apr 26, 2015
1 parent 216411e commit 3688da2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 22 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
54 changes: 34 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 "[email protected]"}}
: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 "[email protected]"
: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 "[email protected]"}}
; :info {:version "1.0.0"
; :title "Sausages"
; :description "Sausage description"
; :termsOfService "http://helloreverb.com/terms/"
; :contact {:email "[email protected]"
; :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 ""}}}}
Expand Down Expand Up @@ -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])

Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 3688da2

Please sign in to comment.