Skip to content

Commit 5b0a248

Browse files
committed
Merge branch 'master' of github.com:metosin/ring-swagger
2 parents e29ac13 + 78b4259 commit 5b0a248

File tree

7 files changed

+51
-7
lines changed

7 files changed

+51
-7
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ bower_components
1313
*.log
1414
**/#*
1515
.#*
16+
gh-pages

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[Swagger](http://swagger.io/) implementation for Clojure/Ring using [Prismatic Schema](https://github.com/Prismatic/schema) for data modeling.
44

5+
- [API Docs](http://metosin.github.io/ring-swagger/doc/)
56
- Supports both 1.2 and 2.0 Swagger Specs
67
- For web developers
78
- Extendable Schema->JSON Mappings with out-of-the-box support for most common types
@@ -24,6 +25,7 @@
2425
- [Compojure-Api](https://github.com/metosin/compojure-api) for Compojure
2526
- [fnhouse-swagger](https://github.com/metosin/fnhouse-swagger) for fnhouse
2627
- [pedastal-swagger](https://github.com/frankiesardo/pedestal-swagger) for Pedastal
28+
- [yada](https://github.com/juxt/yada)
2729

2830
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.
2931

project.clj

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@
1818
[org.flatland/ordered "1.5.2"]]
1919
:profiles {:dev {:plugins [[lein-clojars "0.9.1"]
2020
[lein-ring "0.9.4"]
21-
[lein-midje "3.1.3"]]
21+
[lein-midje "3.1.3"]
22+
[funcool/codeina "0.1.0"]]
2223
:dependencies [[midje "1.7.0-SNAPSHOT"]
2324
[ring-mock "0.1.5"]
2425
[metosin/scjsv "0.2.0"]
2526
[metosin/ring-swagger-ui "2.0.24"]
2627
[javax.servlet/servlet-api "2.5"]]}
2728
:1.7 {:dependencies [[org.clojure/clojure "1.7.0-alpha4"]]}}
29+
:codeina {:sources ["src"]
30+
:output-dir "gh-pages/doc"
31+
:src-dir-uri "http://github.com/metosin/ring-swagger/blob/master/"
32+
:src-linenum-anchor-prefix "L" }
2833
:aliases {"all" ["with-profile" "dev:dev,1.7"]
2934
"test-ancient" ["midje"]})

scripts/build-docs.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
rev=$(git rev-parse HEAD)
4+
remoteurl=$(git ls-remote --get-url origin)
5+
6+
git fetch
7+
if [[ -z $(git branch -r --list origin/gh-pages) ]]; then
8+
(
9+
mkdir gh-pages
10+
cd gh-pages
11+
git init
12+
git remote add origin ${remoteurl}
13+
git checkout -b gh-pages
14+
git commit --allow-empty -m "Init"
15+
git push -u origin gh-pages
16+
)
17+
elif [[ ! -d gh-pages ]]; then
18+
git clone --branch gh-pages ${remoteurl} gh-pages
19+
else
20+
(
21+
cd gh-pages
22+
git pull
23+
)
24+
fi
25+
26+
mkdir -p gh-pages/doc
27+
lein doc
28+
cd gh-pages
29+
git add --all
30+
git commit -m "Build docs from ${rev}."
31+
git push origin gh-pages

src/ring/swagger/common.clj

+5-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424

2525
(defn extract-parameters
2626
"Extract parameters from head of the list. Parameters can be:
27-
1) a map (if followed by any form) [{:a 1 :b 2} :body] => {:a 1 :b 2}
28-
2) list of keywords & values [:a 1 :b 2 :body] => {:a 1 :b 2}
29-
3) else => {}
27+
28+
1. a map (if followed by any form) `[{:a 1 :b 2} :body]` => `{:a 1 :b 2}`
29+
2. list of keywords & values `[:a 1 :b 2 :body]` => `{:a 1 :b 2}`
30+
3. else => `{}`
31+
3032
Returns a tuple with parameters and body without the parameters"
3133
[c]
3234
{:pre [(sequential? c)]}

src/ring/swagger/json_schema_dirty.clj

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
(ns ring.swagger.json-schema-dirty
2+
"Json-type multimethod implementations for some Schemas which can't be
3+
properly described using Json Schema."
24
(:require [ring.swagger.json-schema :refer :all]))
35

46
(defmethod json-type schema.core.ConditionalSchema [e]

src/ring/swagger/ui.clj

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525
default is to serve swagger-ui at \"/\".
2626
2727
Other options can be given using keyword-value pairs.
28-
:root - the root prefix to get resources from. Default 'swagger-ui'
29-
:swagger-docs - the endpoint to get swagger data from. Default '/swagger.json'
30-
:oauth2 - map with oauth2 params, namely :client-id, :realm and :app-name"
28+
29+
- **:root** the root prefix to get resources from. Default 'swagger-ui'
30+
- **:swagger-docs** the endpoint to get swagger data from. Default '/swagger.json'
31+
- **:oauth2** map with oauth2 params, namely `:client-id`, `:realm` and `:app-name`"
3132
[& params]
3233
(let [[path kvs] (if (string? (first params))
3334
[(first params) (rest params)]

0 commit comments

Comments
 (0)