mirror of
https://github.com/metosin/reitit.git
synced 2025-12-17 00:11:11 +00:00
Update swagger-examples to have closed-spec validation
This commit is contained in:
parent
6efe4f612b
commit
1d72575e48
4 changed files with 36 additions and 18 deletions
|
|
@ -1,18 +1,18 @@
|
|||
(ns example.server
|
||||
(:require [reitit.ring :as ring]
|
||||
[reitit.http :as http]
|
||||
[reitit.coercion.spec]
|
||||
[reitit.swagger :as swagger]
|
||||
[reitit.swagger-ui :as swagger-ui]
|
||||
[reitit.http.coercion :as coercion]
|
||||
[reitit.coercion.spec :as spec-coercion]
|
||||
[reitit.dev.pretty :as pretty]
|
||||
[reitit.interceptor.sieppari :as sieppari]
|
||||
[reitit.http.interceptors.parameters :as parameters]
|
||||
[reitit.http.interceptors.muuntaja :as muuntaja]
|
||||
[reitit.http.interceptors.exception :as exception]
|
||||
[reitit.http.interceptors.multipart :as multipart]
|
||||
[reitit.http.spec :as spec]
|
||||
[reitit.http.interceptors.dev :as dev]
|
||||
[reitit.interceptor.sieppari :as sieppari]
|
||||
[reitit.dev.pretty :as pretty]
|
||||
[reitit.http.spec :as spec]
|
||||
[spec-tools.spell :as spell]
|
||||
[ring.adapter.jetty :as jetty]
|
||||
[aleph.http :as client]
|
||||
|
|
@ -114,9 +114,9 @@
|
|||
|
||||
{;:reitit.interceptor/transform dev/print-context-diffs ;; pretty context diffs
|
||||
;;:validate spec/validate ;; enable spec validation for route data
|
||||
;;:reitit.spec/wrap spell/closed ;; strict top-level validation (alpha)
|
||||
;;:reitit.spec/wrap spell/closed ;; strict top-level validation
|
||||
:exception pretty/exception
|
||||
:data {:coercion spec-coercion/coercion
|
||||
:data {:coercion reitit.coercion.spec/coercion
|
||||
:muuntaja m/instance
|
||||
:interceptors [;; swagger feature
|
||||
swagger/swagger-feature
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
(ns example.server
|
||||
(:require [io.pedestal.http :as server]
|
||||
[reitit.pedestal :as pedestal]
|
||||
[reitit.ring :as ring]
|
||||
[reitit.http :as http]
|
||||
[reitit.coercion.spec]
|
||||
[reitit.swagger :as swagger]
|
||||
[reitit.swagger-ui :as swagger-ui]
|
||||
[reitit.http.coercion :as coercion]
|
||||
[reitit.coercion.spec :as spec-coercion]
|
||||
[reitit.http.interceptors.parameters :as parameters]
|
||||
[reitit.http.interceptors.muuntaja :as muuntaja]
|
||||
[reitit.http.interceptors.exception :as exception]
|
||||
[reitit.http.interceptors.multipart :as multipart]
|
||||
[reitit.http.interceptors.dev :as dev]
|
||||
[reitit.dev.pretty :as pretty]
|
||||
[spec-tools.spell :as spell]
|
||||
[reitit.http.spec :as spec]
|
||||
[spec-tools.spell :as spell]
|
||||
[io.pedestal.http :as server]
|
||||
[reitit.pedestal :as pedestal]
|
||||
[clojure.core.async :as a]
|
||||
[clojure.java.io :as io]
|
||||
[muuntaja.core :as m]))
|
||||
|
|
@ -82,9 +82,9 @@
|
|||
|
||||
{;:reitit.interceptor/transform dev/print-context-diffs ;; pretty context diffs
|
||||
;;:validate spec/validate ;; enable spec validation for route data
|
||||
;;:reitit.spec/wrap spell/closed ;; strict top-level validation (alpha)
|
||||
;;:reitit.spec/wrap spell/closed ;; strict top-level validation
|
||||
:exception pretty/exception
|
||||
:data {:coercion spec-coercion/coercion
|
||||
:data {:coercion reitit.coercion.spec/coercion
|
||||
:muuntaja m/instance
|
||||
:interceptors [;; swagger feature
|
||||
swagger/swagger-feature
|
||||
|
|
|
|||
|
|
@ -1,13 +1,17 @@
|
|||
(ns example.server
|
||||
(:require [reitit.ring :as ring]
|
||||
[reitit.coercion.spec]
|
||||
[reitit.swagger :as swagger]
|
||||
[reitit.swagger-ui :as swagger-ui]
|
||||
[reitit.ring.coercion :as coercion]
|
||||
[reitit.coercion.spec]
|
||||
[reitit.dev.pretty :as pretty]
|
||||
[reitit.ring.middleware.muuntaja :as muuntaja]
|
||||
[reitit.ring.middleware.exception :as exception]
|
||||
[reitit.ring.middleware.multipart :as multipart]
|
||||
[reitit.ring.middleware.parameters :as parameters]
|
||||
[reitit.ring.middleware.dev :as dev]
|
||||
[reitit.ring.spec :as spec]
|
||||
[spec-tools.spell :as spell]
|
||||
[ring.adapter.jetty :as jetty]
|
||||
[muuntaja.core :as m]
|
||||
[clojure.spec.alpha :as s]
|
||||
|
|
@ -72,9 +76,15 @@
|
|||
{:status 200
|
||||
:body {:total (+ x y)}})}}]]]
|
||||
|
||||
{:data {:coercion reitit.coercion.spec/coercion
|
||||
{;;:reitit.middleware/transform dev/print-request-diffs ;; pretty diffs
|
||||
;;:validate spec/validate ;; enable spec validation for route data
|
||||
;;:reitit.spec/wrap spell/closed ;; strict top-level validation
|
||||
:exception pretty/exception
|
||||
:data {:coercion reitit.coercion.spec/coercion
|
||||
:muuntaja m/instance
|
||||
:middleware [;; query-params & form-params
|
||||
:middleware [;; swagger feature
|
||||
swagger/swagger-feature
|
||||
;; query-params & form-params
|
||||
parameters/parameters-middleware
|
||||
;; content-negotiation
|
||||
muuntaja/format-negotiate-middleware
|
||||
|
|
|
|||
|
|
@ -1,14 +1,17 @@
|
|||
(ns example.server
|
||||
(:require [reitit.ring :as ring]
|
||||
[reitit.coercion.spec]
|
||||
[reitit.swagger :as swagger]
|
||||
[reitit.swagger-ui :as swagger-ui]
|
||||
[reitit.ring.coercion :as coercion]
|
||||
[reitit.coercion.spec]
|
||||
[reitit.dev.pretty :as pretty]
|
||||
[reitit.ring.middleware.muuntaja :as muuntaja]
|
||||
[reitit.ring.middleware.exception :as exception]
|
||||
[reitit.ring.middleware.multipart :as multipart]
|
||||
[reitit.ring.middleware.parameters :as parameters]
|
||||
[reitit.ring.middleware.dev :as dev]
|
||||
[reitit.ring.spec :as spec]
|
||||
[spec-tools.spell :as spell]
|
||||
[ring.adapter.jetty :as jetty]
|
||||
[muuntaja.core :as m]
|
||||
[clojure.java.io :as io]))
|
||||
|
|
@ -61,10 +64,15 @@
|
|||
{:status 200
|
||||
:body {:total (+ x y)}})}}]]]
|
||||
|
||||
{;;:reitit.middleware/transform dev/print-request-diffs
|
||||
{;;:reitit.middleware/transform dev/print-request-diffs ;; pretty diffs
|
||||
;;:validate spec/validate ;; enable spec validation for route data
|
||||
;;:reitit.spec/wrap spell/closed ;; strict top-level validation
|
||||
:exception pretty/exception
|
||||
:data {:coercion reitit.coercion.spec/coercion
|
||||
:muuntaja m/instance
|
||||
:middleware [;; query-params & form-params
|
||||
:middleware [;; swagger feature
|
||||
swagger/swagger-feature
|
||||
;; query-params & form-params
|
||||
parameters/parameters-middleware
|
||||
;; content-negotiation
|
||||
muuntaja/format-negotiate-middleware
|
||||
|
|
|
|||
Loading…
Reference in a new issue