Skip to content

Commit a4c7312

Browse files
author
John Berry
committed
Fix typos and clarity issues in doc-strings
1 parent 99ae56d commit a4c7312

7 files changed

Lines changed: 22 additions & 21 deletions

File tree

src/compojure/api/common.clj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
(:require [org.tobereplaced.lettercase :as lc]))
33

44
(defn path-vals
5-
"Returns vector of tuples containing path vector to the value and the value."
5+
"Returns vector of tuples each containing the path vector to the
6+
value in the first position, and the value in the second position."
67
[m]
78
(letfn
89
[(pvals [l p m]
@@ -15,7 +16,7 @@
1516
(pvals [] [] m)))
1617

1718
(defn assoc-in-path-vals
18-
"Re-created a map from it's path-vals extracted with (path-vals)."
19+
"Re-creates a map from its path-vals extracted with (path-vals)."
1920
[c] (reduce (partial apply assoc-in) {} c))
2021

2122
(defmacro re-resolve
@@ -34,7 +35,7 @@
3435
(defn eval-re-resolve [x] (eval `(re-resolve ~x)))
3536

3637
(defn assoc-map-ordered
37-
"assocs a value into a map forcing the implementation to be
38+
"assocs a value into a map, forcing the implementation to be
3839
clojure.lang.PersistentArrayMap instead of clojure.lang.PersistentHashMap,
3940
thus retaining the insertion order. O(n)."
4041
[m k v] (apply array-map (into (vec (apply concat m)) [k v])))

src/compojure/api/core.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
6262
optionally be followed by a doc-string and metadata map. Generates an
6363
extra private Var with `_` + name to the given namespace holding the
6464
actual routes, caller doesn't have to care about this. Accessing defroutes*
65-
over Var add tiny run-time penalty, but allows massive better development
66-
speed as the defroutes* can be compiled seperately."
65+
over Var adds a tiny run-time penalty, but allows massively improved
66+
development speed as the defroutes* can be compiled seperately."
6767
[name & routes]
6868
(let [source (drop 2 &form)
6969
[name routes] (name-with-attributes name routes)

src/compojure/api/meta.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
(throw
127127
(IllegalArgumentException.
128128
(str
129-
"You are using old format with :responses. Since Compojure-api 0.21.0, "
129+
"You are using an old format with :responses. Since Compojure-api 0.21.0, "
130130
"plain ring-swagger 2.0 models are used. Example:\n\n"
131131
":responses {400 nil}\n"
132132
":responses {400 {:schema ErrorSchema}}\n"
@@ -193,7 +193,7 @@
193193
(defmethod restructure-param :tags [_ tags acc]
194194
(update-in acc [:parameters :tags] (comp set into) tags))
195195

196-
; Defines a return type and coerced the return value of a body against it.
196+
; Defines a return type and coerces the return value of a body against it.
197197
; Examples:
198198
; :return MySchema
199199
; :return {:value String}

src/compojure/api/middleware.clj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
(error-handler error))))
4848

4949
(defn wrap-exceptions
50-
"Catches all exceptions and delegates to right error handler accoring to :type of Exceptions
50+
"Catches all exceptions and delegates to correct error handler according to :type of Exceptions
5151
- **:handlers** - a map from exception type to handler
5252
- **:compojure.api.exception/default** - Handler used when exception type doesn't match other handler,
5353
by default prints stack trace."
@@ -148,7 +148,7 @@
148148
(throw+ e)))
149149

150150
(defn serializable?
151-
"Predicate which return true if the response body is serializable.
151+
"Predicate which returns true if the response body is serializable.
152152
That is, return type is set by :return compojure-api key or it's
153153
a collection."
154154
[_ {:keys [body] :as response}]
@@ -186,7 +186,7 @@
186186
187187
Note: To catch Schema errors use {:schema.core/error compojure.api.exception/schema-error-handler}
188188
189-
Note: Adding alias for exception namespace makes it easier to define these options.
189+
Note: Adding an alias for exception namespace makes it easier to define these options.
190190
191191
- **:format** for ring-middleware-format middlewares
192192
- **:formats** sequence of supported formats, e.g. `[:json-kw :edn]`
@@ -199,7 +199,7 @@
199199
e.g. `{:ignore-missing-mappings? true}`
200200
201201
- **:coercion** A function from request->type->coercion-matcher, used
202-
in enpoint coersion for :json, :query and :response.
202+
in endpoint coercion for :json, :query and :response.
203203
Defaults to `compojure.api.middleware/default-coercion-matchers`
204204
205205
- **:components** Components which should be accessible to handlers using

src/compojure/api/swagger.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@
339339
(boolean (swagger-spec-path api)))
340340

341341
(defn validate
342-
"Validates a api. If the api is Swagger-enabled, the swagger-docs
342+
"Validates an api. If the api is Swagger-enabled, the swagger-docs
343343
endpoint is requested. Returns either the (valid) api or throws an
344344
exception."
345345
[api]

test/compojure/api/coercion_test.clj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
ping-route)]
2323
(get* app "/ping") => (fails-with 500)))
2424

25-
(fact "response-coersion can ba disabled"
25+
(fact "response-coercion can be disabled"
2626
(let [app (api
2727
{:coercion mw/no-response-coercion}
2828
ping-route)]
2929
(let [[status body] (get* app "/ping")]
3030
status => 200
3131
body => {:pong 123})))))
3232

33-
(fact "body coersion"
33+
(fact "body coercion"
3434
(let [beer-route (POST* "/beer" []
3535
:body [body {:beers #{(s/enum "ipa" "apa")}}]
3636
(ok body))]
@@ -42,7 +42,7 @@
4242
status => 200
4343
body => {:beers ["ipa" "apa"]})))
4444

45-
(fact "body-coersion can ba disabled"
45+
(fact "body-coercion can be disabled"
4646
(let [no-body-coercion (constantly (dissoc mw/default-coercion-matchers :body))
4747
app (api
4848
{:coercion no-body-coercion}
@@ -51,14 +51,14 @@
5151
status => 200
5252
body => {:beers ["ipa" "apa" "ipa"]})))
5353

54-
(fact "body-coersion can ba changed"
54+
(fact "body-coercion can be changed"
5555
(let [nop-body-coercion (constantly (assoc mw/default-coercion-matchers :body (constantly nil)))
5656
app (api
5757
{:coercion nop-body-coercion}
5858
beer-route)]
5959
(post* app "/beer" (json {:beers ["ipa" "apa" "ipa"]})) => (fails-with 400)))))
6060

61-
(fact "query coersion"
61+
(fact "query coercion"
6262
(let [query-route (GET* "/query" []
6363
:query-params [i :- s/Int]
6464
(ok {:i i}))]
@@ -70,7 +70,7 @@
7070
status => 200
7171
body => {:i 10})))
7272

73-
(fact "query-coersion can ba disabled"
73+
(fact "query-coercion can be disabled"
7474
(let [no-query-coercion (constantly (dissoc mw/default-coercion-matchers :string))
7575
app (api
7676
{:coercion no-query-coercion}
@@ -79,14 +79,14 @@
7979
status => 200
8080
body => {:i "10"})))
8181

82-
(fact "query-coersion can ba changed"
82+
(fact "query-coercion can be changed"
8383
(let [nop-query-coercion (constantly (assoc mw/default-coercion-matchers :string (constantly nil)))
8484
app (api
8585
{:coercion nop-query-coercion}
8686
query-route)]
8787
(get* app "/query" {:i 10}) => (fails-with 400)))))
8888

89-
(fact "route-spesific coercion"
89+
(fact "route-specific coercion"
9090
(let [app (api
9191
(GET* "/default" []
9292
:query-params [i :- s/Int]

test/compojure/api/swagger_test.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282

8383

8484
(fact "->swagger2info"
85-
(fact "old format get's converted to new with warnings"
85+
(fact "old format gets converted to new with warnings"
8686
(binding [*out* (StringWriter.)]
8787
(select-swagger2-parameters
8888
{:version ..version..

0 commit comments

Comments
 (0)