diff --git a/CHANGELOG.md b/CHANGELOG.md index 98ce97a2a..6798a8f16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -448,7 +448,7 @@ We use [Break Versioning][breakver]. The version numbers follow a `.. ()` that can side-effect in case of validation errors. +But there is a better way. Router has a `:validation` hook to validate the whole route tree after it's successfully compiled. It expects a 2-arity function `routes opts => ()` that can side-effect in case of validation errors. ## clojure.spec diff --git a/doc/coercion/clojure_spec_coercion.md b/doc/coercion/clojure_spec_coercion.md index cc27816cf..1ed88845c 100644 --- a/doc/coercion/clojure_spec_coercion.md +++ b/doc/coercion/clojure_spec_coercion.md @@ -4,7 +4,7 @@ The [clojure.spec](https://clojure.org/guides/spec) library specifies the struct ## Warning -`clojure.spec` by itself doesn't support coercion. `reitit` uses [spec-tools](https://github.com/metosin/spec-tools) that adds coercion to spec. Like `clojure.spec`, it's alpha as it leans both on spec walking and `clojure.spec.alpha/conform`, which is concidered a spec internal, that might be changed or removed later. +`clojure.spec` by itself doesn't support coercion. `reitit` uses [spec-tools](https://github.com/metosin/spec-tools) that adds coercion to spec. Like `clojure.spec`, it's alpha as it leans both on spec walking and `clojure.spec.alpha/conform`, which is considered a spec internal, that might be changed or removed later. ## Usage diff --git a/doc/coercion/coercion.md b/doc/coercion/coercion.md index 078b3261f..04f9ad106 100644 --- a/doc/coercion/coercion.md +++ b/doc/coercion/coercion.md @@ -125,7 +125,7 @@ We can use a helper function `reitit.coercion/coerce!` to do the actual coercion ; {:path {:company "metosin", :user-id 123}} ``` -We get the coerced paremeters back. If a coercion fails, a typed (`:reitit.coercion/request-coercion`) ExceptionInfo is thrown, with data about the actual error: +We get the coerced parameters back. If a coercion fails, a typed (`:reitit.coercion/request-coercion`) ExceptionInfo is thrown, with data about the actual error: ```clj (coercion/coerce! diff --git a/doc/http/sieppari.md b/doc/http/sieppari.md index 63807794e..8691876ed 100644 --- a/doc/http/sieppari.md +++ b/doc/http/sieppari.md @@ -6,9 +6,9 @@ [Sieppari](https://github.com/metosin/sieppari) is a new and fast interceptor implementation for Clojure, with pluggable async supporting [core.async](https://github.com/clojure/core.async), [Manifold](https://github.com/ztellman/manifold) and [Promesa](http://funcool.github.io/promesa/latest). -To use Sieppari with `reitit-http`, we need to attach a `reitit.interceptor.sieppari/executor` to a `http-router` to compile and execute the interceptor chains. Reitit and Sieppari share the same interceptor model, so all reitit default interceptors work seamlesly together. +To use Sieppari with `reitit-http`, we need to attach a `reitit.interceptor.sieppari/executor` to a `http-router` to compile and execute the interceptor chains. Reitit and Sieppari share the same interceptor model, so all reitit default interceptors work seamlessly together. -We can use both syncronous ring and [async-ring](https://www.booleanknot.com/blog/2016/07/15/asynchronous-ring.html) with Sieppari. +We can use both synchronous ring and [async-ring](https://www.booleanknot.com/blog/2016/07/15/asynchronous-ring.html) with Sieppari. ## Synchronous Ring diff --git a/doc/ring/RESTful_form_methods.md b/doc/ring/RESTful_form_methods.md index 42185ade8..6ab793b5c 100644 --- a/doc/ring/RESTful_form_methods.md +++ b/doc/ring/RESTful_form_methods.md @@ -33,4 +33,4 @@ And apply the middleware like this: wrap-hidden-method]}) ;; our hidden method wrapper ``` (NOTE: This middleware must be placed here and not inside the route data given to `reitit.ring/handler`. -This is so that our middleware is applied before reitit matches the request with a spesific handler using the wrong method.) +This is so that our middleware is applied before reitit matches the request with a specific handler using the wrong method.) diff --git a/doc/ring/data_driven_middleware.md b/doc/ring/data_driven_middleware.md index 439c18048..daf069af2 100644 --- a/doc/ring/data_driven_middleware.md +++ b/doc/ring/data_driven_middleware.md @@ -6,7 +6,7 @@ Reitit defines middleware as data: 1. Middleware can be defined as first-class data entries 2. Middleware can be mounted as a [duct-style](https://github.com/duct-framework/duct/wiki/Configuration) vector (of middleware) -4. Middleware can be optimized & [compiled](compiling_middleware.md) againt an endpoint +4. Middleware can be optimized & [compiled](compiling_middleware.md) against an endpoint 3. Middleware chain can be transformed by the router ## Middleware as data diff --git a/doc/ring/default_middleware.md b/doc/ring/default_middleware.md index 07a7a05e9..f24db2ecf 100644 --- a/doc/ring/default_middleware.md +++ b/doc/ring/default_middleware.md @@ -53,7 +53,7 @@ A preconfigured middleware using `exception/default-handlers`. Catches: ### `exception/create-exception-middleware` -Creates the exception-middleware with custom options. Takes a map of `identifier => exception request => response` that is used to select the exception handler for the thrown/raised exception identifier. Exception idenfier is either a `Keyword` or a Exception Class. +Creates the exception-middleware with custom options. Takes a map of `identifier => exception request => response` that is used to select the exception handler for the thrown/raised exception identifier. Exception identifier is either a `Keyword` or a Exception Class. The following handlers are available by default: @@ -66,7 +66,7 @@ The following handlers are available by default: | `::exception/default` | a default exception handler if nothing else matched (default `exception/default-handler`). | `::exception/wrap` | a 3-arity handler to wrap the actual handler `handler exception request => response` (no default). -The handler is selected from the options map by exception idenfitifier in the following lookup order: +The handler is selected from the options map by exception identifier in the following lookup order: 1) `:type` of exception ex-data 2) Class of exception diff --git a/doc/ring/route_data_validation.md b/doc/ring/route_data_validation.md index 402a1b300..a2f938b18 100644 --- a/doc/ring/route_data_validation.md +++ b/doc/ring/route_data_validation.md @@ -265,7 +265,7 @@ Or even flatten the routes: ::rs/explain e/expound-str}))) ``` -The common Middleware can also be pushed to the router, here cleanly separing behavior and data: +The common Middleware can also be pushed to the router, here cleanly separating behavior and data: ```clj (def app diff --git a/doc/ring/swagger.md b/doc/ring/swagger.md index 7f28defd3..03bb05bfb 100644 --- a/doc/ring/swagger.md +++ b/doc/ring/swagger.md @@ -29,7 +29,7 @@ Coercion keys also contribute to the docs: | key | description | | --------------|-------------| | :parameters | optional input parameters for a route, in a format defined by the coercion -| :responses | optional descriptions of responess, in a format defined by coercion +| :responses | optional descriptions of responses, in a format defined by coercion There is a `reitit.swagger.swagger-feature`, which acts as both a `Middleware` and an `Interceptor` that is not participating in any request processing - it just defines the route data specs for the routes it's mounted to. It is only needed if the [route data validation](route_data_validation.md) is turned on. @@ -55,7 +55,7 @@ If you need to post-process the generated spec, just wrap the handler with a cus | :root | optional resource root, defaults to `"swagger-ui"` | :url | path to swagger endpoint, defaults to `/swagger.json` | :path | optional path to mount the handler to. Works only if mounted outside of a router. -| :config | parameters passed to swaggger-ui as-is. See [the docs](https://github.com/swagger-api/swagger-ui/tree/2.x#parameters) +| :config | parameters passed to swagger-ui as-is. See [the docs](https://github.com/swagger-api/swagger-ui/tree/2.x#parameters) We use swagger-ui from [ring-swagger-ui](https://github.com/metosin/ring-swagger-ui), which can be easily configured from routing application. It stores files `swagger-ui` in the resource classpath. diff --git a/examples/frontend-auth/src/frontend/core.cljs b/examples/frontend-auth/src/frontend/core.cljs index 17bd99e60..d054b610a 100644 --- a/examples/frontend-auth/src/frontend/core.cljs +++ b/examples/frontend-auth/src/frontend/core.cljs @@ -140,7 +140,7 @@ (fn [new-match] (swap! state (fn [state] (if new-match - ;; Only run the controllers, which are likely to call authentcated APIs, + ;; Only run the controllers, which are likely to call authenticated APIs, ;; if user has been authenticated. ;; Alternative solution could be to always run controllers, ;; check authentication status in each controller, or check authentication status in API calls. diff --git a/examples/frontend-prompt/src/frontend/core.cljs b/examples/frontend-prompt/src/frontend/core.cljs index 27754c1d0..2b589678d 100644 --- a/examples/frontend-prompt/src/frontend/core.cljs +++ b/examples/frontend-prompt/src/frontend/core.cljs @@ -31,7 +31,7 @@ ;; key here. See how it's handled in `on-navigate` function. :prompt "Are you sure you want to leave?" ;; It would be possible to define a function here that resolves - ;; wheter prompting is needed or not but we'll keep it simple. + ;; whether prompting is needed or not but we'll keep it simple. }]]) (def router diff --git a/modules/reitit-frontend/src/reitit/frontend/history.cljs b/modules/reitit-frontend/src/reitit/frontend/history.cljs index 35cbf52da..98098d0df 100644 --- a/modules/reitit-frontend/src/reitit/frontend/history.cljs +++ b/modules/reitit-frontend/src/reitit/frontend/history.cljs @@ -83,7 +83,7 @@ ignore-anchor-click (fn ignore-anchor-click [e] - ;; Returns the next matching anchestor of event target + ;; Returns the next matching ancestor of event target (when-let [el (closest-by-tag (event-target e) "a")] (let [uri (.parse Uri (.-href el))] (when (and (or (and (not (.hasScheme uri)) (not (.hasDomain uri))) @@ -125,7 +125,7 @@ Returns History object. - When using with development workflow like Figwheel, rememeber to + When using with development workflow like Figwheel, remember to remove listeners using stop! call before calling start! again. Parameters: diff --git a/modules/reitit-http/src/reitit/http.cljc b/modules/reitit-http/src/reitit/http.cljc index e4a9a6ca2..ef62ad088 100644 --- a/modules/reitit-http/src/reitit/http.cljc +++ b/modules/reitit-http/src/reitit/http.cljc @@ -70,7 +70,7 @@ (r/router data opts)))) (defn routing-interceptor - "Creates a Pedestal-style routing interceptor that enqueus the interceptors into context. + "Creates a Pedestal-style routing interceptor that enqueues the interceptors into context. Takes http-router, default ring-handler and and options map, with the following keys: | key | description | diff --git a/modules/reitit-interceptors/src/reitit/http/interceptors/exception.clj b/modules/reitit-interceptors/src/reitit/http/interceptors/exception.clj index 7ee909ab4..f0a47a1d8 100644 --- a/modules/reitit-interceptors/src/reitit/http/interceptors/exception.clj +++ b/modules/reitit-interceptors/src/reitit/http/interceptors/exception.clj @@ -85,17 +85,17 @@ (defn exception-interceptor "Creates an Interceptor that catches all exceptions. Takes a map of `identifier => exception request => response` that is used to select - the exception handler for the thown/raised exception identifier. Exception - idenfier is either a `Keyword` or a Exception Class. + the exception handler for the thrown/raised exception identifier. Exception + identifier is either a `Keyword` or a Exception Class. The following handlers special handlers are available: | key | description |------------------------|------------- - | `::exception/default` | a default exception handler if nothing else mathced (default [[default-handler]]). + | `::exception/default` | a default exception handler if nothing else matched (default [[default-handler]]). | `::exception/wrap` | a 3-arity handler to wrap the actual handler `handler exception request => response` - The handler is selected from the options map by exception idenfiter + The handler is selected from the options map by exception identifier in the following lookup order: 1) `:type` of exception ex-data diff --git a/modules/reitit-middleware/src/reitit/ring/middleware/exception.clj b/modules/reitit-middleware/src/reitit/ring/middleware/exception.clj index 81f691f06..62a9a03c7 100644 --- a/modules/reitit-middleware/src/reitit/ring/middleware/exception.clj +++ b/modules/reitit-middleware/src/reitit/ring/middleware/exception.clj @@ -118,17 +118,17 @@ (defn create-exception-middleware "Creates a Middleware that catches all exceptions. Takes a map of `identifier => exception request => response` that is used to select - the exception handler for the thown/raised exception identifier. Exception - idenfier is either a `Keyword` or a Exception Class. + the exception handler for the thrown/raised exception identifier. Exception + identifier is either a `Keyword` or a Exception Class. The following handlers special handlers are available: | key | description |------------------------|------------- - | `::exception/default` | a default exception handler if nothing else mathced (default [[default-handler]]). + | `::exception/default` | a default exception handler if nothing else matched (default [[default-handler]]). | `::exception/wrap` | a 3-arity handler to wrap the actual handler `handler exception request => response` - The handler is selected from the options map by exception idenfiter + The handler is selected from the options map by exception identifier in the following lookup order: 1) `:type` of exception ex-data diff --git a/modules/reitit-swagger/src/reitit/swagger.cljc b/modules/reitit-swagger/src/reitit/swagger.cljc index 442552385..0338c43d4 100644 --- a/modules/reitit-swagger/src/reitit/swagger.cljc +++ b/modules/reitit-swagger/src/reitit/swagger.cljc @@ -39,7 +39,7 @@ | key | description | | --------------|-------------| | :parameters | optional input parameters for a route, in a format defined by the coercion - | :responses | optional descriptions of responess, in a format defined by coercion + | :responses | optional descriptions of responses, in a format defined by coercion Example: diff --git a/project.clj b/project.clj index 17ba0f20c..2c3247069 100644 --- a/project.clj +++ b/project.clj @@ -10,7 +10,7 @@ :metadata {:doc/format :markdown}} :scm {:name "git" :url "https://github.com/metosin/reitit"} - ;; TODO: need to verify that the code actually workd with Java1.8, see #242 + ;; TODO: need to verify that the code actually worked with Java1.8, see #242 :javac-options ["-Xlint:unchecked" "-target" "1.8" "-source" "1.8"] :managed-dependencies [[metosin/reitit "0.3.4"] [metosin/reitit-core "0.3.4"] diff --git a/test/clj/reitit/http_coercion_test.clj b/test/clj/reitit/http_coercion_test.clj index 4586eabbe..7e4e4059f 100644 --- a/test/clj/reitit/http_coercion_test.clj +++ b/test/clj/reitit/http_coercion_test.clj @@ -120,7 +120,7 @@ :coercion schema/coercion}}) {:executor sieppari/executor}))] - (testing "withut exception handling" + (testing "without exception handling" (let [app (create [(rrc/coerce-request-interceptor) (rrc/coerce-response-interceptor)])] diff --git a/test/clj/reitit/pedestal_test.clj b/test/clj/reitit/pedestal_test.clj index f1942fe90..bfc4d04d2 100644 --- a/test/clj/reitit/pedestal_test.clj +++ b/test/clj/reitit/pedestal_test.clj @@ -8,7 +8,7 @@ (is (= #{0 1 2} (#'pedestal/arities (fn ([]) ([_]) ([_ _])))))) (deftest interceptor-test - (testing "wihtout :enter, :leave or :error are stripped" + (testing "without :enter, :leave or :error are stripped" (is (nil? (pedestal/->interceptor {:name ::kikka})))) (testing ":error arities are wrapped" (let [has-2-arity-error? (fn [interceptor]