mirror of
https://github.com/metosin/reitit.git
synced 2026-02-07 20:33:12 +00:00
commit
88170bc495
66 changed files with 2146 additions and 2043 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -13,4 +13,4 @@ pom.xml.asc
|
||||||
/_book
|
/_book
|
||||||
figwheel_server.log
|
figwheel_server.log
|
||||||
/.idea
|
/.idea
|
||||||
.clj-kondo/cache
|
.clj-kondo
|
||||||
|
|
|
||||||
2
.lsp/config.edn
Normal file
2
.lsp/config.edn
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
{:cljfmt {:indents {for-all [[:inner 0]]
|
||||||
|
are [[:inner 0]]}}}
|
||||||
13
CHANGELOG.md
13
CHANGELOG.md
|
|
@ -18,6 +18,19 @@ We use [Break Versioning][breakver]. The version numbers follow a `<major>.<mino
|
||||||
|
|
||||||
* Improved Reitit-frontend function docstrings
|
* Improved Reitit-frontend function docstrings
|
||||||
|
|
||||||
|
* Updated deps:
|
||||||
|
|
||||||
|
```clj
|
||||||
|
[metosin/ring-swagger-ui "4.3.0"] is available but we use "3.46.0"
|
||||||
|
[metosin/jsonista "0.3.5"] is available but we use "0.3.3"
|
||||||
|
[metosin/malli "0.8.1"] is available but we use "0.5.1"
|
||||||
|
[com.fasterxml.jackson.core/jackson-core "2.13.1"] is available but we use "2.12.4"
|
||||||
|
[com.fasterxml.jackson.core/jackson-databind "2.13.1"] is available but we use "2.12.4"
|
||||||
|
[fipp "0.6.25"] is available but we use "0.6.24"
|
||||||
|
[expound "0.9.0"] is available but we use "0.8.9"
|
||||||
|
[ring/ring-core "1.9.5"] is available but we use "1.9.4"
|
||||||
|
```
|
||||||
|
|
||||||
## 0.5.15 (2021-08-05)
|
## 0.5.15 (2021-08-05)
|
||||||
|
|
||||||
**[compare](https://github.com/metosin/reitit/compare/0.5.14...0.5.15)**
|
**[compare](https://github.com/metosin/reitit/compare/0.5.14...0.5.15)**
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,13 @@
|
||||||
./scripts/test.sh cljs
|
./scripts/test.sh cljs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Formatting
|
||||||
|
|
||||||
|
```bash
|
||||||
|
clojure-lsp format
|
||||||
|
clojure-lsp clean-ns
|
||||||
|
```
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
The documentation lives under `doc` and it is hosted on [cljdoc](https://cljdoc.org). See their
|
The documentation lives under `doc` and it is hosted on [cljdoc](https://cljdoc.org). See their
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
(ns reitit.coercion
|
(ns reitit.coercion
|
||||||
(:require [clojure.walk :as walk]
|
(:require
|
||||||
|
[clojure.walk :as walk]
|
||||||
[reitit.impl :as impl])
|
[reitit.impl :as impl])
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(:import (java.io Writer))))
|
(:import
|
||||||
|
(java.io Writer))))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Protocol
|
;; Protocol
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
(ns reitit.core
|
(ns reitit.core
|
||||||
(:require [reitit.impl :as impl]
|
(:require
|
||||||
[reitit.exception :as exception]
|
[reitit.exception :as exception]
|
||||||
|
[reitit.impl :as impl]
|
||||||
[reitit.trie :as trie]))
|
[reitit.trie :as trie]))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
(ns reitit.dependency
|
(ns reitit.dependency
|
||||||
"Dependency resolution for middleware/interceptors."
|
"Dependency resolution for middleware/interceptors."
|
||||||
(:require [reitit.exception :as exception]))
|
(:require
|
||||||
|
[reitit.exception :as exception]))
|
||||||
|
|
||||||
(defn- providers
|
(defn- providers
|
||||||
"Map from provision key to provider. `get-provides` should return the provision keys of a dependent."
|
"Map from provision key to provider. `get-provides` should return the provision keys of a dependent."
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
(ns reitit.exception
|
(ns reitit.exception
|
||||||
(:require [clojure.string :as str]))
|
(:require
|
||||||
|
[clojure.string :as str]))
|
||||||
|
|
||||||
(defn fail!
|
(defn fail!
|
||||||
([type]
|
([type]
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
(ns ^:no-doc reitit.impl
|
(ns ^:no-doc reitit.impl
|
||||||
#?(:cljs (:require-macros [reitit.impl]))
|
#?(:cljs (:require-macros [reitit.impl]))
|
||||||
(:require [clojure.string :as str]
|
(:require
|
||||||
[clojure.set :as set]
|
[clojure.set :as set]
|
||||||
|
[clojure.string :as str]
|
||||||
[meta-merge.core :as mm]
|
[meta-merge.core :as mm]
|
||||||
[reitit.trie :as trie]
|
[reitit.exception :as ex]
|
||||||
[reitit.exception :as ex])
|
[reitit.trie :as trie])
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(:import (java.util HashMap Map)
|
(:import
|
||||||
(java.net URLEncoder URLDecoder))))
|
(java.net URLEncoder URLDecoder)
|
||||||
|
(java.util HashMap Map))))
|
||||||
|
|
||||||
(defn parse [path opts]
|
(defn parse [path opts]
|
||||||
(let [path #?(:clj (.intern ^String (trie/normalize path opts)) :cljs (trie/normalize path opts))
|
(let [path #?(:clj (.intern ^String (trie/normalize path opts)) :cljs (trie/normalize path opts))
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
(ns reitit.interceptor
|
(ns reitit.interceptor
|
||||||
(:require [meta-merge.core :refer [meta-merge]]
|
(:require
|
||||||
[clojure.pprint :as pprint]
|
[clojure.pprint :as pprint]
|
||||||
|
[meta-merge.core :refer [meta-merge]]
|
||||||
[reitit.core :as r]
|
[reitit.core :as r]
|
||||||
[reitit.impl :as impl]
|
[reitit.exception :as exception]
|
||||||
[reitit.exception :as exception]))
|
[reitit.impl :as impl]))
|
||||||
|
|
||||||
(defprotocol IntoInterceptor
|
(defprotocol IntoInterceptor
|
||||||
(into-interceptor [this data opts]))
|
(into-interceptor [this data opts]))
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
(ns reitit.middleware
|
(ns reitit.middleware
|
||||||
(:require [meta-merge.core :refer [meta-merge]]
|
(:require
|
||||||
[clojure.pprint :as pprint]
|
[clojure.pprint :as pprint]
|
||||||
|
[meta-merge.core :refer [meta-merge]]
|
||||||
[reitit.core :as r]
|
[reitit.core :as r]
|
||||||
[reitit.impl :as impl]
|
[reitit.exception :as exception]
|
||||||
[reitit.exception :as exception]))
|
[reitit.impl :as impl]))
|
||||||
|
|
||||||
(defprotocol IntoMiddleware
|
(defprotocol IntoMiddleware
|
||||||
(into-middleware [this data opts]))
|
(into-middleware [this data opts]))
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
(ns reitit.spec
|
(ns reitit.spec
|
||||||
(:require [clojure.spec.alpha :as s]
|
(:require
|
||||||
|
[clojure.spec.alpha :as s]
|
||||||
[clojure.spec.gen.alpha :as gen]
|
[clojure.spec.gen.alpha :as gen]
|
||||||
[reitit.exception :as exception]
|
[reitit.core :as r]
|
||||||
[reitit.core :as r]))
|
[reitit.exception :as exception]))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; routes
|
;; routes
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
(ns reitit.trie
|
(ns reitit.trie
|
||||||
(:refer-clojure :exclude [compile])
|
(:refer-clojure :exclude [compile])
|
||||||
(:require [clojure.string :as str]
|
(:require
|
||||||
|
[clojure.string :as str]
|
||||||
[reitit.exception :as ex])
|
[reitit.exception :as ex])
|
||||||
#?(:clj (:import [reitit Trie Trie$Match Trie$Matcher]
|
#?(:clj (:import
|
||||||
(java.net URLDecoder))))
|
(java.net URLDecoder)
|
||||||
|
[reitit Trie Trie$Match Trie$Matcher])))
|
||||||
|
|
||||||
(defn ^:no-doc into-set [x]
|
(defn ^:no-doc into-set [x]
|
||||||
(cond
|
(cond
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,17 @@
|
||||||
(ns reitit.dev.pretty
|
(ns reitit.dev.pretty
|
||||||
(:require [clojure.string :as str]
|
(:require
|
||||||
|
[arrangement.core] ;; spell-spec
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[reitit.exception :as exception]
|
[clojure.string :as str]
|
||||||
[arrangement.core]
|
[expound.alpha] ;; fipp
|
||||||
;; spell-spec
|
|
||||||
[spell-spec.expound]
|
|
||||||
;; expound
|
|
||||||
[expound.ansi]
|
[expound.ansi]
|
||||||
[expound.alpha]
|
|
||||||
;; fipp
|
|
||||||
[fipp.visit]
|
|
||||||
[fipp.edn]
|
[fipp.edn]
|
||||||
[fipp.ednize]
|
[fipp.ednize]
|
||||||
[fipp.engine]))
|
[fipp.engine]
|
||||||
|
[fipp.visit]
|
||||||
|
[reitit.exception :as exception]
|
||||||
|
[spell-spec.expound] ;; expound
|
||||||
|
))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; colors
|
;; colors
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
(ns reitit.frontend
|
(ns reitit.frontend
|
||||||
(:require [clojure.set :as set]
|
(:require
|
||||||
|
[clojure.set :as set]
|
||||||
[reitit.coercion :as coercion]
|
[reitit.coercion :as coercion]
|
||||||
[reitit.core :as r])
|
[reitit.core :as r])
|
||||||
(:import goog.Uri
|
(:import
|
||||||
|
goog.Uri
|
||||||
goog.Uri.QueryData))
|
goog.Uri.QueryData))
|
||||||
|
|
||||||
(defn- query-param [^QueryData q k]
|
(defn- query-param [^QueryData q k]
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
"Easy wrapper over reitit.frontend.history,
|
"Easy wrapper over reitit.frontend.history,
|
||||||
handling the state. Only one router can be active
|
handling the state. Only one router can be active
|
||||||
at a time."
|
at a time."
|
||||||
(:require [reitit.frontend.history :as rfh]))
|
(:require
|
||||||
|
[reitit.frontend.history :as rfh]))
|
||||||
|
|
||||||
(defonce history (atom nil))
|
(defonce history (atom nil))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
(ns reitit.frontend.history
|
(ns reitit.frontend.history
|
||||||
"Provides integration to hash-change or HTML5 History
|
"Provides integration to hash-change or HTML5 History
|
||||||
events."
|
events."
|
||||||
(:require [reitit.core :as reitit]
|
(:require
|
||||||
[reitit.frontend :as rf]
|
[goog.events :as gevents]
|
||||||
[goog.events :as gevents])
|
[reitit.core :as reitit]
|
||||||
(:import goog.Uri))
|
[reitit.frontend :as rf])
|
||||||
|
(:import
|
||||||
|
goog.Uri))
|
||||||
|
|
||||||
(defprotocol History
|
(defprotocol History
|
||||||
(-init [this] "Create event listeners")
|
(-init [this] "Create event listeners")
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
(ns reitit.http
|
(ns reitit.http
|
||||||
(:require [meta-merge.core :refer [meta-merge]]
|
(:require
|
||||||
[reitit.interceptor :as interceptor]
|
[meta-merge.core :refer [meta-merge]]
|
||||||
|
[reitit.core :as r]
|
||||||
[reitit.exception :as ex]
|
[reitit.exception :as ex]
|
||||||
[reitit.ring :as ring]
|
[reitit.interceptor :as interceptor]
|
||||||
[reitit.core :as r]))
|
[reitit.ring :as ring]))
|
||||||
|
|
||||||
(defrecord Endpoint [data interceptors queue handler path method])
|
(defrecord Endpoint [data interceptors queue handler path method])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
(ns reitit.http.coercion
|
(ns reitit.http.coercion
|
||||||
(:require [reitit.coercion :as coercion]
|
(:require
|
||||||
[reitit.spec :as rs]
|
[reitit.coercion :as coercion]
|
||||||
[reitit.impl :as impl]))
|
[reitit.impl :as impl]
|
||||||
|
[reitit.spec :as rs]))
|
||||||
|
|
||||||
(defn coerce-request-interceptor
|
(defn coerce-request-interceptor
|
||||||
"Interceptor for pluggable request coercion.
|
"Interceptor for pluggable request coercion.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
(ns reitit.http.spec
|
(ns reitit.http.spec
|
||||||
(:require [clojure.spec.alpha :as s]
|
(:require
|
||||||
[reitit.ring.spec :as rrs]
|
[clojure.spec.alpha :as s]
|
||||||
[reitit.interceptor :as interceptor]
|
|
||||||
[reitit.exception :as exception]
|
[reitit.exception :as exception]
|
||||||
|
[reitit.interceptor :as interceptor]
|
||||||
|
[reitit.ring.spec :as rrs]
|
||||||
[reitit.spec :as rs]))
|
[reitit.spec :as rs]))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
(ns reitit.http.interceptors.dev
|
(ns reitit.http.interceptors.dev
|
||||||
(:require [lambdaisland.deep-diff :as ddiff]
|
(:require
|
||||||
|
[lambdaisland.deep-diff :as ddiff]
|
||||||
[lambdaisland.deep-diff.printer :as printer]
|
[lambdaisland.deep-diff.printer :as printer]
|
||||||
[puget.color :as color]
|
[puget.color :as color]
|
||||||
[reitit.core :as r]))
|
[reitit.core :as r]))
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
(ns reitit.http.interceptors.exception
|
(ns reitit.http.interceptors.exception
|
||||||
(:require [reitit.coercion :as coercion]
|
(:require
|
||||||
[reitit.ring :as ring]
|
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[clojure.string :as str])
|
[clojure.string :as str]
|
||||||
(:import (java.time Instant)
|
[reitit.coercion :as coercion]
|
||||||
(java.io PrintWriter Writer)))
|
[reitit.ring :as ring])
|
||||||
|
(:import
|
||||||
|
(java.io PrintWriter Writer)
|
||||||
|
(java.time Instant)))
|
||||||
|
|
||||||
(s/def ::handlers (s/map-of any? fn?))
|
(s/def ::handlers (s/map-of any? fn?))
|
||||||
(s/def ::spec (s/keys :opt-un [::handlers]))
|
(s/def ::spec (s/keys :opt-un [::handlers]))
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
(ns reitit.http.interceptors.multipart
|
(ns reitit.http.interceptors.multipart
|
||||||
(:require [reitit.coercion :as coercion]
|
(:require
|
||||||
|
[clojure.spec.alpha :as s]
|
||||||
|
[reitit.coercion :as coercion]
|
||||||
[reitit.spec]
|
[reitit.spec]
|
||||||
[ring.middleware.multipart-params :as multipart-params]
|
[ring.middleware.multipart-params :as multipart-params]
|
||||||
[clojure.spec.alpha :as s]
|
|
||||||
[spec-tools.core :as st])
|
[spec-tools.core :as st])
|
||||||
(:import (java.io File)))
|
(:import
|
||||||
|
(java.io File)))
|
||||||
|
|
||||||
(s/def ::filename string?)
|
(s/def ::filename string?)
|
||||||
(s/def ::content-type string?)
|
(s/def ::content-type string?)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
(ns reitit.http.interceptors.muuntaja
|
(ns reitit.http.interceptors.muuntaja
|
||||||
(:require [muuntaja.core :as m]
|
(:require
|
||||||
[muuntaja.interceptor]
|
[clojure.spec.alpha :as s]
|
||||||
[clojure.spec.alpha :as s]))
|
[muuntaja.core :as m]
|
||||||
|
[muuntaja.interceptor]))
|
||||||
|
|
||||||
(s/def ::muuntaja m/muuntaja?)
|
(s/def ::muuntaja m/muuntaja?)
|
||||||
(s/def ::spec (s/keys :opt-un [::muuntaja]))
|
(s/def ::spec (s/keys :opt-un [::muuntaja]))
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
(ns reitit.http.interceptors.parameters
|
(ns reitit.http.interceptors.parameters
|
||||||
(:require [ring.middleware.params :as params]))
|
(:require
|
||||||
|
[ring.middleware.params :as params]))
|
||||||
|
|
||||||
(defn parameters-interceptor
|
(defn parameters-interceptor
|
||||||
"Interceptor to parse urlencoded parameters from the query string and form
|
"Interceptor to parse urlencoded parameters from the query string and form
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
(ns reitit.coercion.malli
|
(ns reitit.coercion.malli
|
||||||
(:require [reitit.coercion :as coercion]
|
(:require
|
||||||
[malli.transform :as mt]
|
[clojure.set :as set]
|
||||||
|
[clojure.walk :as walk]
|
||||||
|
[malli.core :as m]
|
||||||
[malli.edn :as edn]
|
[malli.edn :as edn]
|
||||||
[malli.error :as me]
|
[malli.error :as me]
|
||||||
[malli.util :as mu]
|
|
||||||
[malli.swagger :as swagger]
|
[malli.swagger :as swagger]
|
||||||
[malli.core :as m]
|
[malli.transform :as mt]
|
||||||
[clojure.set :as set]
|
[malli.util :as mu]
|
||||||
[clojure.walk :as walk]))
|
[reitit.coercion :as coercion]))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; coercion
|
;; coercion
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
(ns reitit.ring.malli
|
(ns reitit.ring.malli
|
||||||
#?(:clj (:import (java.io File))))
|
#?(:clj (:import
|
||||||
|
(java.io File))))
|
||||||
|
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(def temp-file-part
|
(def temp-file-part
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
(ns reitit.ring.middleware.dev
|
(ns reitit.ring.middleware.dev
|
||||||
(:require [lambdaisland.deep-diff :as ddiff]
|
(:require
|
||||||
|
[lambdaisland.deep-diff :as ddiff]
|
||||||
[lambdaisland.deep-diff.printer :as printer]
|
[lambdaisland.deep-diff.printer :as printer]
|
||||||
[puget.color :as color]
|
[puget.color :as color]
|
||||||
[reitit.core :as r]))
|
[reitit.core :as r]))
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
(ns reitit.ring.middleware.exception
|
(ns reitit.ring.middleware.exception
|
||||||
(:require [reitit.coercion :as coercion]
|
(:require
|
||||||
[reitit.ring :as ring]
|
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[clojure.string :as str])
|
[clojure.string :as str]
|
||||||
(:import (java.time Instant)
|
[reitit.coercion :as coercion]
|
||||||
(java.io Writer PrintWriter)))
|
[reitit.ring :as ring])
|
||||||
|
(:import
|
||||||
|
(java.io Writer PrintWriter)
|
||||||
|
(java.time Instant)))
|
||||||
|
|
||||||
(s/def ::handlers (s/map-of any? fn?))
|
(s/def ::handlers (s/map-of any? fn?))
|
||||||
(s/def ::spec (s/keys :opt-un [::handlers]))
|
(s/def ::spec (s/keys :opt-un [::handlers]))
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
(ns reitit.ring.middleware.multipart
|
(ns reitit.ring.middleware.multipart
|
||||||
(:refer-clojure :exclude [compile])
|
(:refer-clojure :exclude [compile])
|
||||||
(:require [reitit.coercion :as coercion]
|
(:require
|
||||||
[ring.middleware.multipart-params :as multipart-params]
|
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
|
[reitit.coercion :as coercion]
|
||||||
|
[ring.middleware.multipart-params :as multipart-params]
|
||||||
[spec-tools.core :as st])
|
[spec-tools.core :as st])
|
||||||
(:import (java.io File)))
|
(:import
|
||||||
|
(java.io File)))
|
||||||
|
|
||||||
(s/def ::filename string?)
|
(s/def ::filename string?)
|
||||||
(s/def ::content-type string?)
|
(s/def ::content-type string?)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
(ns reitit.ring.middleware.muuntaja
|
(ns reitit.ring.middleware.muuntaja
|
||||||
(:require [muuntaja.core :as m]
|
(:require
|
||||||
[muuntaja.middleware]
|
[clojure.spec.alpha :as s]
|
||||||
[clojure.spec.alpha :as s]))
|
[muuntaja.core :as m]
|
||||||
|
[muuntaja.middleware]))
|
||||||
|
|
||||||
(s/def ::muuntaja m/muuntaja?)
|
(s/def ::muuntaja m/muuntaja?)
|
||||||
(s/def ::spec (s/keys :opt-un [::muuntaja]))
|
(s/def ::spec (s/keys :opt-un [::muuntaja]))
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
(ns reitit.ring.middleware.parameters
|
(ns reitit.ring.middleware.parameters
|
||||||
(:require [ring.middleware.params :as params]))
|
(:require
|
||||||
|
[ring.middleware.params :as params]))
|
||||||
|
|
||||||
(def parameters-middleware
|
(def parameters-middleware
|
||||||
"Middleware to parse urlencoded parameters from the query string and form
|
"Middleware to parse urlencoded parameters from the query string and form
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
(ns reitit.pedestal
|
(ns reitit.pedestal
|
||||||
(:require [io.pedestal.interceptor.chain :as chain]
|
(:require
|
||||||
[io.pedestal.interceptor :as interceptor]
|
|
||||||
[io.pedestal.http :as http]
|
[io.pedestal.http :as http]
|
||||||
[reitit.interceptor]
|
[io.pedestal.interceptor :as interceptor]
|
||||||
[reitit.http])
|
[io.pedestal.interceptor.chain :as chain]
|
||||||
(:import (reitit.interceptor Executor)
|
[reitit.http]
|
||||||
(java.lang.reflect Method)))
|
[reitit.interceptor])
|
||||||
|
(:import
|
||||||
|
(java.lang.reflect Method)
|
||||||
|
(reitit.interceptor Executor)))
|
||||||
|
|
||||||
;; TODO: variadic
|
;; TODO: variadic
|
||||||
(defn- arities [f]
|
(defn- arities [f]
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
(ns reitit.ring
|
(ns reitit.ring
|
||||||
(:require [meta-merge.core :refer [meta-merge]]
|
(:require
|
||||||
[reitit.middleware :as middleware]
|
[clojure.string :as str]
|
||||||
[reitit.exception :as ex]
|
[meta-merge.core :refer [meta-merge]]
|
||||||
[reitit.core :as r]
|
|
||||||
[reitit.impl :as impl]
|
|
||||||
#?@(:clj [[ring.util.mime-type :as mime-type]
|
#?@(:clj [[ring.util.mime-type :as mime-type]
|
||||||
[ring.util.response :as response]])
|
[ring.util.response :as response]])
|
||||||
[clojure.string :as str]))
|
[reitit.core :as r]
|
||||||
|
[reitit.exception :as ex]
|
||||||
|
[reitit.impl :as impl]
|
||||||
|
[reitit.middleware :as middleware]))
|
||||||
|
|
||||||
(declare get-match)
|
(declare get-match)
|
||||||
(declare get-router)
|
(declare get-router)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
(ns reitit.ring.coercion
|
(ns reitit.ring.coercion
|
||||||
(:require [reitit.coercion :as coercion]
|
(:require
|
||||||
[reitit.spec :as rs]
|
[reitit.coercion :as coercion]
|
||||||
[reitit.impl :as impl]))
|
[reitit.impl :as impl]
|
||||||
|
[reitit.spec :as rs]))
|
||||||
|
|
||||||
(defn handle-coercion-exception [e respond raise]
|
(defn handle-coercion-exception [e respond raise]
|
||||||
(let [data (ex-data e)]
|
(let [data (ex-data e)]
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
(ns reitit.ring.spec
|
(ns reitit.ring.spec
|
||||||
(:require [clojure.spec.alpha :as s]
|
(:require
|
||||||
|
[clojure.spec.alpha :as s]
|
||||||
|
[reitit.exception :as exception]
|
||||||
[reitit.middleware :as middleware]
|
[reitit.middleware :as middleware]
|
||||||
[reitit.spec :as rs]
|
[reitit.spec :as rs]))
|
||||||
[reitit.exception :as exception]))
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Specs
|
;; Specs
|
||||||
|
|
@ -19,7 +20,6 @@
|
||||||
(s/def ::trace map?)
|
(s/def ::trace map?)
|
||||||
(s/def ::patch map?)
|
(s/def ::patch map?)
|
||||||
|
|
||||||
|
|
||||||
(s/def ::data
|
(s/def ::data
|
||||||
(s/keys :opt-un [::rs/handler ::rs/name ::rs/no-doc ::middleware]))
|
(s/keys :opt-un [::rs/handler ::rs/name ::rs/no-doc ::middleware]))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
(ns reitit.coercion.schema
|
(ns reitit.coercion.schema
|
||||||
(:require [clojure.walk :as walk]
|
(:require
|
||||||
[schema.core :as s]
|
[clojure.set :as set]
|
||||||
[schema-tools.core :as st]
|
[clojure.walk :as walk]
|
||||||
[schema.coerce :as sc]
|
|
||||||
[schema.utils :as su]
|
|
||||||
[schema-tools.coerce :as stc]
|
|
||||||
[schema-tools.swagger.core :as swagger]
|
|
||||||
[reitit.coercion :as coercion]
|
[reitit.coercion :as coercion]
|
||||||
[clojure.set :as set]))
|
[schema-tools.coerce :as stc]
|
||||||
|
[schema-tools.core :as st]
|
||||||
|
[schema-tools.swagger.core :as swagger]
|
||||||
|
[schema.coerce :as sc]
|
||||||
|
[schema.core :as s]
|
||||||
|
[schema.utils :as su]))
|
||||||
|
|
||||||
(def string-coercion-matcher
|
(def string-coercion-matcher
|
||||||
stc/string-coercion-matcher)
|
stc/string-coercion-matcher)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
(ns reitit.ring.schema
|
(ns reitit.ring.schema
|
||||||
(:require [schema.core :as s]
|
(:require
|
||||||
[schema-tools.swagger.core :as swagger])
|
[schema-tools.swagger.core :as swagger]
|
||||||
#?(:clj (:import (java.io File))))
|
[schema.core :as s])
|
||||||
|
#?(:clj (:import
|
||||||
|
(java.io File))))
|
||||||
|
|
||||||
(defrecord Upload [m]
|
(defrecord Upload [m]
|
||||||
s/Schema
|
s/Schema
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
(ns reitit.interceptor.sieppari
|
(ns reitit.interceptor.sieppari
|
||||||
(:require [reitit.interceptor :as interceptor]
|
(:require
|
||||||
[sieppari.queue :as queue]
|
[reitit.interceptor :as interceptor]
|
||||||
[sieppari.core :as sieppari]))
|
[sieppari.core :as sieppari]
|
||||||
|
[sieppari.queue :as queue]))
|
||||||
|
|
||||||
(def executor
|
(def executor
|
||||||
(reify
|
(reify
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
(ns reitit.coercion.spec
|
(ns reitit.coercion.spec
|
||||||
(:require [clojure.spec.alpha :as s]
|
(:require
|
||||||
|
[clojure.set :as set]
|
||||||
|
[clojure.spec.alpha :as s]
|
||||||
|
[reitit.coercion :as coercion]
|
||||||
[spec-tools.core :as st #?@(:cljs [:refer [Spec]])]
|
[spec-tools.core :as st #?@(:cljs [:refer [Spec]])]
|
||||||
[spec-tools.data-spec :as ds #?@(:cljs [:refer [Maybe]])]
|
[spec-tools.data-spec :as ds #?@(:cljs [:refer [Maybe]])]
|
||||||
[spec-tools.swagger.core :as swagger]
|
[spec-tools.swagger.core :as swagger])
|
||||||
[reitit.coercion :as coercion]
|
|
||||||
[clojure.set :as set])
|
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(:import (spec_tools.core Spec)
|
(:import
|
||||||
|
(spec_tools.core Spec)
|
||||||
(spec_tools.data_spec Maybe))))
|
(spec_tools.data_spec Maybe))))
|
||||||
|
|
||||||
(def string-transformer
|
(def string-transformer
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
(ns reitit.swagger-ui
|
(ns reitit.swagger-ui
|
||||||
#?(:clj (:require [reitit.ring :as ring]
|
#?(:clj (:require
|
||||||
[jsonista.core :as j])))
|
[jsonista.core :as j]
|
||||||
|
[reitit.ring :as ring])))
|
||||||
|
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(defn create-swagger-ui-handler
|
(defn create-swagger-ui-handler
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
(ns reitit.swagger
|
(ns reitit.swagger
|
||||||
(:require [reitit.core :as r]
|
(:require
|
||||||
[meta-merge.core :refer [meta-merge]]
|
|
||||||
[clojure.spec.alpha :as s]
|
|
||||||
[clojure.set :as set]
|
[clojure.set :as set]
|
||||||
|
[clojure.spec.alpha :as s]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
|
[meta-merge.core :refer [meta-merge]]
|
||||||
[reitit.coercion :as coercion]
|
[reitit.coercion :as coercion]
|
||||||
|
[reitit.core :as r]
|
||||||
[reitit.trie :as trie]))
|
[reitit.trie :as trie]))
|
||||||
|
|
||||||
(s/def ::id (s/or :keyword keyword? :set (s/coll-of keyword? :into #{})))
|
(s/def ::id (s/or :keyword keyword? :set (s/coll-of keyword? :into #{})))
|
||||||
|
|
|
||||||
60
project.clj
60
project.clj
|
|
@ -27,33 +27,33 @@
|
||||||
[metosin/reitit-frontend "0.5.15"]
|
[metosin/reitit-frontend "0.5.15"]
|
||||||
[metosin/reitit-sieppari "0.5.15"]
|
[metosin/reitit-sieppari "0.5.15"]
|
||||||
[metosin/reitit-pedestal "0.5.15"]
|
[metosin/reitit-pedestal "0.5.15"]
|
||||||
[metosin/ring-swagger-ui "3.46.0"]
|
[metosin/ring-swagger-ui "4.3.0"]
|
||||||
[metosin/spec-tools "0.10.5"]
|
[metosin/spec-tools "0.10.5"]
|
||||||
[metosin/schema-tools "0.12.3"]
|
[metosin/schema-tools "0.12.3"]
|
||||||
[metosin/muuntaja "0.6.8"]
|
[metosin/muuntaja "0.6.8"]
|
||||||
[metosin/jsonista "0.3.3"]
|
[metosin/jsonista "0.3.5"]
|
||||||
[metosin/sieppari "0.0.0-alpha13"]
|
[metosin/sieppari "0.0.0-alpha13"]
|
||||||
[metosin/malli "0.5.1"]
|
[metosin/malli "0.8.1"]
|
||||||
|
|
||||||
;; https://clojureverse.org/t/depending-on-the-right-versions-of-jackson-libraries/5111
|
;; https://clojureverse.org/t/depending-on-the-right-versions-of-jackson-libraries/5111
|
||||||
[com.fasterxml.jackson.core/jackson-core "2.12.4"]
|
[com.fasterxml.jackson.core/jackson-core "2.13.1"]
|
||||||
[com.fasterxml.jackson.core/jackson-databind "2.12.4"]
|
[com.fasterxml.jackson.core/jackson-databind "2.13.1"]
|
||||||
|
|
||||||
[meta-merge "1.0.0"]
|
[meta-merge "1.0.0"]
|
||||||
[fipp "0.6.24" :exclusions [org.clojure/core.rrb-vector]]
|
[fipp "0.6.25" :exclusions [org.clojure/core.rrb-vector]]
|
||||||
[expound "0.8.9"]
|
[expound "0.9.0"]
|
||||||
[lambdaisland/deep-diff "0.0-47"]
|
[lambdaisland/deep-diff "0.0-47"]
|
||||||
[com.bhauman/spell-spec "0.1.2"]
|
[com.bhauman/spell-spec "0.1.2"]
|
||||||
[ring/ring-core "1.9.4"]
|
[ring/ring-core "1.9.5"]
|
||||||
|
|
||||||
[io.pedestal/pedestal.service "0.5.9"]]
|
[io.pedestal/pedestal.service "0.5.10"]]
|
||||||
|
|
||||||
:plugins [[jonase/eastwood "0.9.6"]
|
:plugins [[jonase/eastwood "1.2.2"]
|
||||||
;[lein-virgil "0.1.7"]
|
;[lein-virgil "0.1.7"]
|
||||||
[lein-doo "0.1.11"]
|
[lein-doo "0.1.11"]
|
||||||
[lein-cljsbuild "1.1.8"]
|
[lein-cljsbuild "1.1.8"]
|
||||||
[lein-cloverage "1.2.2"]
|
[lein-cloverage "1.2.2"]
|
||||||
[lein-codox "0.10.7"]
|
[lein-codox "0.10.8"]
|
||||||
[metosin/bat-test "0.4.4"]]
|
[metosin/bat-test "0.4.4"]]
|
||||||
|
|
||||||
:profiles {:dev {:jvm-opts ^:replace ["-server"]
|
:profiles {:dev {:jvm-opts ^:replace ["-server"]
|
||||||
|
|
@ -85,31 +85,31 @@
|
||||||
[metosin/spec-tools "0.10.5"]
|
[metosin/spec-tools "0.10.5"]
|
||||||
[metosin/muuntaja "0.6.8"]
|
[metosin/muuntaja "0.6.8"]
|
||||||
[metosin/sieppari "0.0.0-alpha13"]
|
[metosin/sieppari "0.0.0-alpha13"]
|
||||||
[metosin/jsonista "0.3.3"]
|
[metosin/jsonista "0.3.5"]
|
||||||
[metosin/malli "0.5.1"]
|
[metosin/malli "0.8.1"]
|
||||||
[lambdaisland/deep-diff "0.0-47"]
|
[lambdaisland/deep-diff "0.0-47"]
|
||||||
[meta-merge "1.0.0"]
|
[meta-merge "1.0.0"]
|
||||||
[com.bhauman/spell-spec "0.1.2"]
|
[com.bhauman/spell-spec "0.1.2"]
|
||||||
[expound "0.8.9"]
|
[expound "0.9.0"]
|
||||||
[fipp "0.6.24"]
|
[fipp "0.6.25"]
|
||||||
|
|
||||||
[orchestra "2021.01.01-1"]
|
[orchestra "2021.01.01-1"]
|
||||||
|
|
||||||
[ring "1.9.4"]
|
[ring "1.9.5"]
|
||||||
[ikitommi/immutant-web "3.0.0-alpha1"]
|
[ikitommi/immutant-web "3.0.0-alpha1"]
|
||||||
[metosin/ring-http-response "0.9.2"]
|
[metosin/ring-http-response "0.9.3"]
|
||||||
[metosin/ring-swagger-ui "3.46.0"]
|
[metosin/ring-swagger-ui "4.3.0"]
|
||||||
|
|
||||||
[criterium "0.4.6"]
|
[criterium "0.4.6"]
|
||||||
[org.clojure/test.check "1.1.0"]
|
[org.clojure/test.check "1.1.1"]
|
||||||
[org.clojure/tools.namespace "1.1.0"]
|
[org.clojure/tools.namespace "1.2.0"]
|
||||||
[com.gfredericks/test.chuck "0.2.11"]
|
[com.gfredericks/test.chuck "0.2.13"]
|
||||||
|
|
||||||
[io.pedestal/pedestal.service "0.5.9"]
|
[io.pedestal/pedestal.service "0.5.10"]
|
||||||
|
|
||||||
[org.clojure/core.async "1.3.618"]
|
[org.clojure/core.async "1.5.648"]
|
||||||
[manifold "0.1.8"]
|
[manifold "0.2.3"]
|
||||||
[funcool/promesa "6.0.2"]
|
[funcool/promesa "6.1.434"]
|
||||||
|
|
||||||
[com.clojure-goes-fast/clj-async-profiler "0.5.1"]
|
[com.clojure-goes-fast/clj-async-profiler "0.5.1"]
|
||||||
[ring-cors "0.1.13"]
|
[ring-cors "0.1.13"]
|
||||||
|
|
@ -123,12 +123,12 @@
|
||||||
:dependencies [[compojure "1.6.2"]
|
:dependencies [[compojure "1.6.2"]
|
||||||
[ring/ring-defaults "0.3.3"]
|
[ring/ring-defaults "0.3.3"]
|
||||||
[ikitommi/immutant-web "3.0.0-alpha1"]
|
[ikitommi/immutant-web "3.0.0-alpha1"]
|
||||||
[io.pedestal/pedestal.service "0.5.9"]
|
[io.pedestal/pedestal.service "0.5.10"]
|
||||||
[io.pedestal/pedestal.jetty "0.5.9"]
|
[io.pedestal/pedestal.jetty "0.5.10"]
|
||||||
[calfpath "0.8.1"]
|
[calfpath "0.8.1"]
|
||||||
[org.clojure/core.async "1.3.618"]
|
[org.clojure/core.async "1.5.648"]
|
||||||
[manifold "0.1.8"]
|
[manifold "0.2.3"]
|
||||||
[funcool/promesa "6.0.2"]
|
[funcool/promesa "6.1.434"]
|
||||||
[metosin/sieppari]
|
[metosin/sieppari]
|
||||||
[yada "1.2.16"]
|
[yada "1.2.16"]
|
||||||
[aleph "0.4.6"]
|
[aleph "0.4.6"]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
(ns cljdoc.reaper
|
(ns cljdoc.reaper
|
||||||
(:require [clojure.java.io :as io]
|
(:require
|
||||||
|
[clojure.java.io :as io]
|
||||||
[clojure.pprint :as pprint]
|
[clojure.pprint :as pprint]
|
||||||
[clojure.string :as str]))
|
[clojure.string :as str]))
|
||||||
|
|
||||||
|
|
@ -14,8 +15,7 @@
|
||||||
(fn [acc data]
|
(fn [acc data]
|
||||||
(if (vector? (first data))
|
(if (vector? (first data))
|
||||||
(update-in acc [(dec (count acc)) 2] (fnil into []) data)
|
(update-in acc [(dec (count acc)) 2] (fnil into []) data)
|
||||||
(conj acc data))
|
(conj acc data))) [])
|
||||||
) [])
|
|
||||||
;; third sweep to flatten chids...
|
;; third sweep to flatten chids...
|
||||||
(mapv (fn [[n o c]] (if c (into [n o] c) [n o]))))
|
(mapv (fn [[n o c]] (if c (into [n o] c) [n o]))))
|
||||||
data {:cljdoc/include-namespaces-from-dependencies ['metosin/reitit
|
data {:cljdoc/include-namespaces-from-dependencies ['metosin/reitit
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
(ns reitit.http.interceptors.exception-test
|
(ns reitit.http.interceptors.exception-test
|
||||||
(:require [clojure.test :refer [deftest testing is]]
|
(:require
|
||||||
[reitit.ring :as ring]
|
[clojure.test :refer [deftest is testing]]
|
||||||
|
[muuntaja.core :as m]
|
||||||
|
[reitit.coercion.spec]
|
||||||
[reitit.http :as http]
|
[reitit.http :as http]
|
||||||
|
[reitit.http.coercion]
|
||||||
[reitit.http.interceptors.exception :as exception]
|
[reitit.http.interceptors.exception :as exception]
|
||||||
[reitit.interceptor.sieppari :as sieppari]
|
[reitit.interceptor.sieppari :as sieppari]
|
||||||
[reitit.coercion.spec]
|
[reitit.ring :as ring])
|
||||||
[reitit.http.coercion]
|
(:import
|
||||||
[muuntaja.core :as m])
|
(java.sql SQLException SQLWarning)))
|
||||||
(:import (java.sql SQLException SQLWarning)))
|
|
||||||
|
|
||||||
(derive ::kikka ::kukka)
|
(derive ::kikka ::kukka)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
(ns reitit.http.interceptors.muuntaja-test
|
(ns reitit.http.interceptors.muuntaja-test
|
||||||
(:require [clojure.test :refer [deftest testing is]]
|
(:require
|
||||||
|
[clojure.test :refer [deftest is testing]]
|
||||||
|
[muuntaja.core :as m]
|
||||||
[reitit.http :as http]
|
[reitit.http :as http]
|
||||||
[reitit.http.interceptors.muuntaja :as muuntaja]
|
[reitit.http.interceptors.muuntaja :as muuntaja]
|
||||||
[reitit.swagger :as swagger]
|
|
||||||
[reitit.interceptor.sieppari :as sieppari]
|
[reitit.interceptor.sieppari :as sieppari]
|
||||||
[muuntaja.core :as m]))
|
[reitit.swagger :as swagger]))
|
||||||
|
|
||||||
(deftest muuntaja-test
|
(deftest muuntaja-test
|
||||||
(let [data {:kikka "kukka"}
|
(let [data {:kikka "kukka"}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
(ns reitit.http.interceptors.parameters-test
|
(ns reitit.http.interceptors.parameters-test
|
||||||
(:require [clojure.test :refer [deftest testing is]]
|
(:require
|
||||||
[reitit.http.interceptors.parameters :as parameters]
|
[clojure.test :refer [deftest is testing]]
|
||||||
[reitit.http :as http]
|
[reitit.http :as http]
|
||||||
|
[reitit.http.interceptors.parameters :as parameters]
|
||||||
[reitit.interceptor.sieppari :as sieppari]
|
[reitit.interceptor.sieppari :as sieppari]
|
||||||
[reitit.swagger :as swagger]))
|
[reitit.swagger :as swagger]))
|
||||||
|
|
||||||
|
|
@ -27,7 +28,7 @@
|
||||||
["/swagger.json" {:get {:no-doc true
|
["/swagger.json" {:get {:no-doc true
|
||||||
:handler (swagger/create-swagger-handler)}}]]
|
:handler (swagger/create-swagger-handler)}}]]
|
||||||
{:data {:interceptors [(parameters/parameters-interceptor)]}})
|
{:data {:interceptors [(parameters/parameters-interceptor)]}})
|
||||||
{:executor sieppari/executor})
|
{:executor sieppari/executor})
|
||||||
spec (fn [path]
|
spec (fn [path]
|
||||||
(-> {:request-method :get :uri "/swagger.json"}
|
(-> {:request-method :get :uri "/swagger.json"}
|
||||||
app
|
app
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,18 @@
|
||||||
(ns reitit.http-coercion-test
|
(ns reitit.http-coercion-test
|
||||||
(:require [clojure.test :refer [deftest testing is]]
|
(:require
|
||||||
[schema.core :as s]
|
[clojure.test :refer [deftest is testing]]
|
||||||
|
[jsonista.core :as j]
|
||||||
|
[muuntaja.interceptor]
|
||||||
|
[reitit.coercion.malli :as malli]
|
||||||
|
[reitit.coercion.schema :as schema]
|
||||||
|
[reitit.coercion.spec :as spec]
|
||||||
|
[reitit.core :as r]
|
||||||
[reitit.http :as http]
|
[reitit.http :as http]
|
||||||
[reitit.http.coercion :as rrc]
|
[reitit.http.coercion :as rrc]
|
||||||
[reitit.coercion.spec :as spec]
|
|
||||||
[reitit.coercion.schema :as schema]
|
|
||||||
[muuntaja.interceptor]
|
|
||||||
[jsonista.core :as j]
|
|
||||||
[reitit.interceptor.sieppari :as sieppari]
|
[reitit.interceptor.sieppari :as sieppari]
|
||||||
[reitit.coercion.malli :as malli]
|
[schema.core :as s])
|
||||||
[reitit.core :as r])
|
(:import
|
||||||
(:import (clojure.lang ExceptionInfo)
|
(clojure.lang ExceptionInfo)
|
||||||
(java.io ByteArrayInputStream)))
|
(java.io ByteArrayInputStream)))
|
||||||
|
|
||||||
(defn mounted-interceptor [app path method]
|
(defn mounted-interceptor [app path method]
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,16 @@
|
||||||
(ns reitit.http-test
|
(ns reitit.http-test
|
||||||
"just Clojure before Sieppari is ported into cljs"
|
"just Clojure before Sieppari is ported into cljs"
|
||||||
(:require [clojure.test :refer [deftest testing is]]
|
(:require
|
||||||
|
[clojure.core.async :as a]
|
||||||
[clojure.set :as set]
|
[clojure.set :as set]
|
||||||
|
[clojure.test :refer [deftest is testing]]
|
||||||
|
[reitit.core :as r]
|
||||||
|
[reitit.http :as http]
|
||||||
[reitit.interceptor :as interceptor]
|
[reitit.interceptor :as interceptor]
|
||||||
[reitit.interceptor.sieppari :as sieppari]
|
[reitit.interceptor.sieppari :as sieppari]
|
||||||
[reitit.http :as http]
|
[reitit.ring :as ring])
|
||||||
[reitit.ring :as ring]
|
(:import
|
||||||
[reitit.core :as r]
|
(clojure.lang ExceptionInfo)))
|
||||||
[clojure.core.async :as a])
|
|
||||||
(:import (clojure.lang ExceptionInfo)))
|
|
||||||
|
|
||||||
(defn interceptor [name]
|
(defn interceptor [name]
|
||||||
{:enter (fn [ctx] (update-in ctx [:request ::i] (fnil conj []) name))})
|
{:enter (fn [ctx] (update-in ctx [:request ::i] (fnil conj []) name))})
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
(ns reitit.pedestal-test
|
(ns reitit.pedestal-test
|
||||||
(:require [clojure.test :refer [deftest testing is]]
|
(:require
|
||||||
[io.pedestal.test]
|
[clojure.test :refer [deftest is testing]]
|
||||||
[io.pedestal.http]
|
[io.pedestal.http]
|
||||||
|
[io.pedestal.test]
|
||||||
[reitit.http :as http]
|
[reitit.http :as http]
|
||||||
[reitit.pedestal :as pedestal]
|
[reitit.http.interceptors.exception :as exception]
|
||||||
[reitit.http.interceptors.exception :as exception]))
|
[reitit.pedestal :as pedestal]))
|
||||||
|
|
||||||
(deftest arities-test
|
(deftest arities-test
|
||||||
(is (= #{0} (#'pedestal/arities (fn []))))
|
(is (= #{0} (#'pedestal/arities (fn []))))
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,16 @@
|
||||||
(ns reitit.ring.middleware.exception-test
|
(ns reitit.ring.middleware.exception-test
|
||||||
(:require [clojure.test :refer [deftest testing is]]
|
(:require
|
||||||
[reitit.ring :as ring]
|
|
||||||
[reitit.ring.middleware.exception :as exception]
|
|
||||||
[reitit.coercion :as coercion]
|
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[reitit.coercion.spec]
|
[clojure.test :refer [deftest is testing]]
|
||||||
[reitit.ring.coercion]
|
|
||||||
[muuntaja.core :as m]
|
[muuntaja.core :as m]
|
||||||
|
[reitit.coercion :as coercion]
|
||||||
|
[reitit.coercion.spec]
|
||||||
|
[reitit.ring :as ring]
|
||||||
|
[reitit.ring.coercion]
|
||||||
|
[reitit.ring.middleware.exception :as exception]
|
||||||
[ring.util.http-response :as http-response])
|
[ring.util.http-response :as http-response])
|
||||||
(:import (java.sql SQLException SQLWarning)))
|
(:import
|
||||||
|
(java.sql SQLException SQLWarning)))
|
||||||
|
|
||||||
(derive ::kikka ::kukka)
|
(derive ::kikka ::kukka)
|
||||||
|
|
||||||
|
|
@ -66,7 +68,6 @@
|
||||||
:response response}))))]
|
:response response}))))]
|
||||||
(is (= response (app {:request-method :post, :uri "/http-response"})))))
|
(is (= response (app {:request-method :post, :uri "/http-response"})))))
|
||||||
|
|
||||||
|
|
||||||
(testing ":muuntaja/decode"
|
(testing ":muuntaja/decode"
|
||||||
(let [app (create (fn [_] (m/decode m/instance "application/json" "{:so \"invalid\"}")))]
|
(let [app (create (fn [_] (m/decode m/instance "application/json" "{:so \"invalid\"}")))]
|
||||||
(is (= {:body "Malformed \"application/json\" request."
|
(is (= {:body "Malformed \"application/json\" request."
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
(ns reitit.ring.middleware.muuntaja-test
|
(ns reitit.ring.middleware.muuntaja-test
|
||||||
(:require [clojure.test :refer [deftest testing is]]
|
(:require
|
||||||
|
[clojure.test :refer [deftest is testing]]
|
||||||
|
[muuntaja.core :as m]
|
||||||
[reitit.ring :as ring]
|
[reitit.ring :as ring]
|
||||||
[reitit.ring.middleware.muuntaja :as muuntaja]
|
[reitit.ring.middleware.muuntaja :as muuntaja]
|
||||||
[reitit.swagger :as swagger]
|
[reitit.swagger :as swagger]))
|
||||||
[muuntaja.core :as m]))
|
|
||||||
|
|
||||||
(deftest muuntaja-test
|
(deftest muuntaja-test
|
||||||
(let [data {:kikka "kukka"}
|
(let [data {:kikka "kukka"}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
(ns reitit.ring.middleware.parameters-test
|
(ns reitit.ring.middleware.parameters-test
|
||||||
(:require [clojure.test :refer [deftest testing is]]
|
(:require
|
||||||
[reitit.ring.middleware.parameters :as parameters]
|
[clojure.test :refer [deftest is testing]]
|
||||||
[reitit.ring :as ring]
|
[reitit.ring :as ring]
|
||||||
|
[reitit.ring.middleware.parameters :as parameters]
|
||||||
[reitit.swagger :as swagger]))
|
[reitit.swagger :as swagger]))
|
||||||
|
|
||||||
(deftest parameters-test
|
(deftest parameters-test
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,16 @@
|
||||||
(ns reitit.coercion-test
|
(ns reitit.coercion-test
|
||||||
(:require [clojure.test :refer [deftest testing is]]
|
(:require
|
||||||
[schema.core :as s]
|
[clojure.test :refer [deftest is testing]]
|
||||||
[spec-tools.data-spec :as ds]
|
|
||||||
[reitit.core :as r]
|
|
||||||
[reitit.coercion :as coercion]
|
[reitit.coercion :as coercion]
|
||||||
[reitit.coercion.spec]
|
|
||||||
[reitit.coercion.malli]
|
[reitit.coercion.malli]
|
||||||
[reitit.coercion.schema])
|
[reitit.coercion.schema]
|
||||||
|
[reitit.coercion.spec]
|
||||||
|
[reitit.core :as r]
|
||||||
|
[schema.core :as s]
|
||||||
|
[spec-tools.data-spec :as ds])
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(:import (clojure.lang ExceptionInfo))))
|
(:import
|
||||||
|
(clojure.lang ExceptionInfo))))
|
||||||
|
|
||||||
(deftest coercion-test
|
(deftest coercion-test
|
||||||
(let [r (r/router
|
(let [r (r/router
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
(ns reitit.core-test
|
(ns reitit.core-test
|
||||||
(:require [clojure.test :refer [deftest testing is are]]
|
(:require
|
||||||
|
[clojure.test :refer [are deftest is testing]]
|
||||||
[reitit.core :as r #?@(:cljs [:refer [Router]])]
|
[reitit.core :as r #?@(:cljs [:refer [Router]])]
|
||||||
[reitit.impl :as impl])
|
[reitit.impl :as impl])
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(:import (reitit.core Router)
|
(:import
|
||||||
(clojure.lang ExceptionInfo))))
|
(clojure.lang ExceptionInfo)
|
||||||
|
(reitit.core Router))))
|
||||||
|
|
||||||
(deftest reitit-test
|
(deftest reitit-test
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
(ns reitit.dependency-test
|
(ns reitit.dependency-test
|
||||||
(:require [clojure.test :refer [deftest testing is are]]
|
(:require
|
||||||
|
[clojure.test :refer [are deftest is testing]]
|
||||||
[reitit.dependency :as rc])
|
[reitit.dependency :as rc])
|
||||||
#?(:clj (:import [clojure.lang ExceptionInfo])))
|
#?(:clj (:import
|
||||||
|
[clojure.lang ExceptionInfo])))
|
||||||
|
|
||||||
(deftest post-order-test
|
(deftest post-order-test
|
||||||
(let [base-middlewares [{:name ::bar, :provides #{:bar}, :requires #{:foo}, :wrap identity}
|
(let [base-middlewares [{:name ::bar, :provides #{:bar}, :requires #{:foo}, :wrap identity}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
(ns reitit.exception-test
|
(ns reitit.exception-test
|
||||||
(:require [clojure.test :refer [deftest testing is are]]
|
(:require
|
||||||
[reitit.spec :as rs]
|
[clojure.spec.alpha :as s]
|
||||||
|
[clojure.test :refer [are deftest is testing]]
|
||||||
[reitit.core :as r]
|
[reitit.core :as r]
|
||||||
[reitit.dev.pretty :as pretty]
|
[reitit.dev.pretty :as pretty]
|
||||||
[clojure.spec.alpha :as s]
|
[reitit.exception :as exception]
|
||||||
[reitit.exception :as exception])
|
[reitit.spec :as rs])
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(:import (clojure.lang ExceptionInfo))))
|
(:import
|
||||||
|
(clojure.lang ExceptionInfo))))
|
||||||
|
|
||||||
(s/def ::role #{:admin :manager})
|
(s/def ::role #{:admin :manager})
|
||||||
(s/def ::roles (s/coll-of ::role :into #{}))
|
(s/def ::roles (s/coll-of ::role :into #{}))
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
(ns reitit.impl-test
|
(ns reitit.impl-test
|
||||||
(:require [clojure.test :refer [deftest testing is are]]
|
(:require
|
||||||
|
[clojure.test :refer [are deftest is testing]]
|
||||||
[reitit.impl :as impl]))
|
[reitit.impl :as impl]))
|
||||||
|
|
||||||
(deftest strip-nils-test
|
(deftest strip-nils-test
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
(ns reitit.interceptor-test
|
(ns reitit.interceptor-test
|
||||||
(:require [clojure.test :refer [deftest testing is are]]
|
(:require
|
||||||
[reitit.interceptor :as interceptor]
|
[clojure.test :refer [are deftest is testing]]
|
||||||
[reitit.core :as r])
|
[reitit.core :as r]
|
||||||
|
[reitit.interceptor :as interceptor])
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(:import (clojure.lang ExceptionInfo))))
|
(:import
|
||||||
|
(clojure.lang ExceptionInfo))))
|
||||||
|
|
||||||
(def ctx (interceptor/context []))
|
(def ctx (interceptor/context []))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
(ns reitit.middleware-test
|
(ns reitit.middleware-test
|
||||||
(:require [clojure.test :refer [deftest testing is are]]
|
(:require
|
||||||
[reitit.middleware :as middleware]
|
[clojure.test :refer [are deftest is testing]]
|
||||||
[reitit.core :as r])
|
[reitit.core :as r]
|
||||||
|
[reitit.middleware :as middleware])
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(:import (clojure.lang ExceptionInfo))))
|
(:import
|
||||||
|
(clojure.lang ExceptionInfo))))
|
||||||
|
|
||||||
(def request [])
|
(def request [])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,19 @@
|
||||||
(ns reitit.ring-coercion-test
|
(ns reitit.ring-coercion-test
|
||||||
(:require [clojure.test :refer [deftest testing is]]
|
(:require
|
||||||
[schema.core :as s]
|
[clojure.test :refer [deftest is testing]]
|
||||||
[spec-tools.data-spec :as ds]
|
|
||||||
[reitit.ring :as ring]
|
|
||||||
[reitit.ring.coercion :as rrc]
|
|
||||||
[reitit.coercion.spec :as spec]
|
|
||||||
[reitit.coercion.malli :as malli]
|
|
||||||
[reitit.coercion.schema :as schema]
|
|
||||||
#?@(:clj [[muuntaja.middleware]
|
#?@(:clj [[muuntaja.middleware]
|
||||||
[jsonista.core :as j]])
|
[jsonista.core :as j]])
|
||||||
[reitit.core :as r])
|
[reitit.coercion.malli :as malli]
|
||||||
|
[reitit.coercion.schema :as schema]
|
||||||
|
[reitit.coercion.spec :as spec]
|
||||||
|
[reitit.core :as r]
|
||||||
|
[reitit.ring :as ring]
|
||||||
|
[reitit.ring.coercion :as rrc]
|
||||||
|
[schema.core :as s]
|
||||||
|
[spec-tools.data-spec :as ds])
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(:import (clojure.lang ExceptionInfo)
|
(:import
|
||||||
|
(clojure.lang ExceptionInfo)
|
||||||
(java.io ByteArrayInputStream))))
|
(java.io ByteArrayInputStream))))
|
||||||
|
|
||||||
(defn mounted-middleware [app path method]
|
(defn mounted-middleware [app path method]
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
(ns reitit.ring-spec-test
|
(ns reitit.ring-spec-test
|
||||||
(:require [clojure.test :refer [deftest testing is]]
|
(:require
|
||||||
[reitit.ring :as ring]
|
|
||||||
[reitit.ring.spec :as rrs]
|
|
||||||
[reitit.ring.coercion :as rrc]
|
|
||||||
[reitit.coercion.spec]
|
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[reitit.core :as r])
|
[clojure.test :refer [deftest is testing]]
|
||||||
|
[reitit.coercion.spec]
|
||||||
|
[reitit.core :as r]
|
||||||
|
[reitit.ring :as ring]
|
||||||
|
[reitit.ring.coercion :as rrc]
|
||||||
|
[reitit.ring.spec :as rrs])
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(:import (clojure.lang ExceptionInfo))))
|
(:import
|
||||||
|
(clojure.lang ExceptionInfo))))
|
||||||
|
|
||||||
(s/def ::role #{:admin :user})
|
(s/def ::role #{:admin :user})
|
||||||
(s/def ::roles (s/and (s/coll-of ::role :into #{}) set?))
|
(s/def ::roles (s/and (s/coll-of ::role :into #{}) set?))
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
(ns reitit.ring-test
|
(ns reitit.ring-test
|
||||||
(:require [clojure.test :refer [deftest testing is]]
|
(:require
|
||||||
[clojure.set :as set]
|
[clojure.set :as set]
|
||||||
|
[clojure.test :refer [deftest is testing]]
|
||||||
|
[reitit.core :as r]
|
||||||
[reitit.middleware :as middleware]
|
[reitit.middleware :as middleware]
|
||||||
[reitit.ring :as ring]
|
[reitit.ring :as ring]
|
||||||
[reitit.core :as r]
|
|
||||||
[reitit.trie :as trie])
|
[reitit.trie :as trie])
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(:import (clojure.lang ExceptionInfo))))
|
(:import
|
||||||
|
(clojure.lang ExceptionInfo))))
|
||||||
|
|
||||||
(defn mw [handler name]
|
(defn mw [handler name]
|
||||||
(fn
|
(fn
|
||||||
|
|
@ -638,7 +640,6 @@
|
||||||
(is (get-in @result [:headers "Last-Modified"]))
|
(is (get-in @result [:headers "Last-Modified"]))
|
||||||
(is (= "<xml><hello>file</hello></xml>\n" (slurp (:body @result))))))))))))))
|
(is (= "<xml><hello>file</hello></xml>\n" (slurp (:body @result))))))))))))))
|
||||||
|
|
||||||
|
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(deftest file-resource-handler-not-found-test
|
(deftest file-resource-handler-not-found-test
|
||||||
(let [redirect (fn [uri] {:status 302, :body "", :headers {"Location" uri}})
|
(let [redirect (fn [uri] {:status 302, :body "", :headers {"Location" uri}})
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
(ns reitit.spec-test
|
(ns reitit.spec-test
|
||||||
(:require [clojure.test :refer [deftest testing is are use-fixtures]]
|
(:require
|
||||||
[#?(:clj clojure.spec.test.alpha :cljs cljs.spec.test.alpha) :as stest]
|
[#?(:clj clojure.spec.test.alpha :cljs cljs.spec.test.alpha) :as stest]
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
|
[clojure.test :refer [are deftest is testing use-fixtures]]
|
||||||
[reitit.core :as r]
|
[reitit.core :as r]
|
||||||
[reitit.spec :as rs])
|
[reitit.spec :as rs])
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(:import (clojure.lang ExceptionInfo))))
|
(:import
|
||||||
|
(clojure.lang ExceptionInfo))))
|
||||||
|
|
||||||
(defn instrument-all [f]
|
(defn instrument-all [f]
|
||||||
(try
|
(try
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
(ns reitit.swagger-test
|
(ns reitit.swagger-test
|
||||||
(:require [clojure.test :refer [deftest is testing]]
|
(:require
|
||||||
[reitit.ring :as ring]
|
[clojure.test :refer [deftest is testing]]
|
||||||
[reitit.swagger :as swagger]
|
[muuntaja.core :as m]
|
||||||
[reitit.swagger-ui :as swagger-ui]
|
|
||||||
[reitit.ring.coercion :as rrc]
|
|
||||||
[reitit.coercion.spec :as spec]
|
|
||||||
[reitit.coercion.malli :as malli]
|
[reitit.coercion.malli :as malli]
|
||||||
[reitit.coercion.schema :as schema]
|
[reitit.coercion.schema :as schema]
|
||||||
[muuntaja.core :as m]
|
[reitit.coercion.spec :as spec]
|
||||||
[spec-tools.data-spec :as ds]
|
[reitit.ring :as ring]
|
||||||
[schema.core :as s]))
|
[reitit.ring.coercion :as rrc]
|
||||||
|
[reitit.swagger :as swagger]
|
||||||
|
[reitit.swagger-ui :as swagger-ui]
|
||||||
|
[schema.core :as s]
|
||||||
|
[spec-tools.data-spec :as ds]))
|
||||||
|
|
||||||
(def app
|
(def app
|
||||||
(ring/ring-handler
|
(ring/ring-handler
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
(ns reitit.trie-test
|
(ns reitit.trie-test
|
||||||
(:require [clojure.test :refer [deftest testing is are]]
|
(:require
|
||||||
|
[clojure.test :refer [are deftest is testing]]
|
||||||
[reitit.trie :as trie]))
|
[reitit.trie :as trie]))
|
||||||
|
|
||||||
(deftest into-set-test
|
(deftest into-set-test
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue