- Preserve response-schema names, fixes #93.
- updated dependencies:
[metosin/ring-swagger "0.20.1"] is available but we use "0.20.0"
-
New restructuring for
:no-docs
(a boolean) - endpoints with this don't get api documentation. -
Fixed #42 -
defroutes*
now does namespace resolution for the source used for route peeling and source linking (the macro magic) -
Fixed #91 -
defroutes*
are now automatically accessed over a Var for better development flow. -
Fixed #89.
-
Fixed #82.
-
Fixed #71, ring-swagger-ui is now a dependency.
-
breaking
ring.swagger.json-schema/describe
is now imported intocompojure.api.sweet
for easy use. If your code refers to it directly, you need remove the direct reference.
- Routes are collected always from the root (
defapi
orcompojure.api.routes/api-root
within that) compojure.api.routes/with-routes
is nowcompojure.api.routes/api-root
- breaking requires the latest swagger-ui to work
[metosin/ring-swagger-ui "2.1.1-M2"]
to get things pre-configured- or package
2.1.1-M2
yourself from the source.
- breaking: api ordering is not implemented.
- breaking: restructuring
:nickname
is now:operationId
- breaking: restructuring
:notes
is now:description
swagger-docs
now takes any valid Swagger Spec data in. Using old format gives a warning is to STDOUT.
(swagger-docs
{:info {:version "1.0.0"
:title "Sausages"
:description "Sausage description"
:termsOfService "http://helloreverb.com/terms/"
:contact {:name "My API Team"
:email "foo@example.com"
:url "http://www.metosin.fi"}
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}}
:tags [{:name "kikka", :description "kukka"}]})
- Swagger-documentation default uri is changed from
/api/api-docs
to/swagger.json
. compojure.api.swagger/swaggered
is deprecated - not relevant with 2.0. Works, but prints out a warning to STDOUT ** in 2.0, apis are categorized byt Tags, one can set them either to endpoints or to paths:
(GET* "/api/pets/" []
:tags ["pet"]
(ok ...))
(context* "/api/pets" []
:tags ["pet"]
(GET* "/" []
:summary "get all pets"
(ok ...)))
- updated deps:
[metosin/ring-swagger "0.20.0"] is available but we use "0.19.4"
[prismatic/schema "0.4.1"] is available but we use "0.4.0"
[prismatic/plumbing "0.4.2"] is available but we use "0.4.1"
[prismatic/schema "0.4.1"] is available but we use "0.4.0"
[potemkin "0.3.13"] is available but we use "0.3.12"
[compojure "1.3.3"] is available but we use "1.3.2"
[metosin/ring-swagger "0.19.4"] is available but we use "0.19.3"
- Compatibility with swagger-ui
2.1.0-M2
-[metosin/ring-swagger-ui "2.1.0-M2-2]
- updated deps:
[metosin/ring-swagger "0.19.3"] is available but we use "0.19.2"
- avoid reflection fixes by Michael Blume
- one can now wrap body & response-models in predicates and get the swagger docs out:
:return (s/maybe User)
:responses {200 (s/maybe User)
400 (s/either Cat Dog)}
- updated deps:
[metosin/ring-swagger "0.19.2"] is available but we use "0.19.1"
- added destructuring for
:headers
, thanks to tchagnon! :path-param
allows any keywords, needed for the partial parameter matching withcontext*
- BREAKING: parameters are collected in (Ring-)Swagger 2.0 format, might break client-side
compojure.api.meta/restructure-param
dispatch functions - for the swagger documentation part. see https://github.com/metosin/ring-swagger/blob/master/test/ring/swagger/swagger2_test.clj & https://github.com/metosin/compojure-api/blob/master/src/compojure/api/meta.clj for examples of the new schemas. context*
to allow setting meta-data to mid-routes. Mid-route meta-data are deep-merged into endpoint swagger-definitions at compile-time. At runtime, code is executed in place.
(context* "/api/:kikka" []
:summary "summary inherited from context"
:path-params [kikka :- s/Str] ; enforced here at runtime
:query-params [kukka :- s/Str] ; enforced here at runtime
(GET* "/:kakka" []
:path-params [kakka :- s/Str] ; enforced here at runtime
(ok {:kikka kikka
:kukka kukka
:kakka kakka})))
- updated deps:
[prismatic/plumbing "0.4.1"] is available but we use "0.3.7"
[potemkin "0.3.12"] is available but we use "0.3.11"
[prismatic/schema "0.4.0"] is available but we use "0.3.7"
[metosin/ring-http-response "0.6.1"] is available but we use "0.6.0"
[metosin/ring-swagger "0.19.0"] is available but we use "0.18.1"
[lein-ring "0.9.3"] is available but we use "0.9.2"
- Support passing options to specific format middlewares (merged into defaults):
(defapi app
{:format {:formats [:json-kw :yaml-kw :edn :transit-json :transit-msgpack]
:params-opts {}
:response-opts {}}
:validation-errors {:error-handler nil
:catch-core-errors? nil}
:exceptions {:exception-handler default-exception-handler}}
...)
- import
compojure.core/wrap-routes
intocompojure.api.sweet
- BREAKING: in
compojure.api.middleware
,ex-info-support
is now parametrizablewrap-exception
- fixes #68
- Update dependencies
[prismatic/plumbing "0.3.7"] is available but we use "0.3.5"
[compojure "1.3.2"] is available but we use "1.3.1"
[prismatic/schema "0.3.7"] is available but we use "0.3.3"
[metosin/ring-swagger "0.18.0"] is available but we use "0.15.0"
[metosin/ring-http-response "0.6.0"] is available but we use "0.5.2"
[metosin/ring-middleware-format "0.6.0"] is available but we use "0.5.0"
- Depend on forked version of
ring-middleware-format
- Transit support should now work
- If you are depending on ring-middleware-format directly, you'll want to either update your dependency or exclude one from compojure-api
- Update dependencies:
[cheshire "5.4.0"] is available but we use "5.3.1"
[metosin/ring-swagger-ui "2.0.24"] is available but we use "2.0.17"
[lein-ring "0.9.0"] is available but we use "0.8.13"
- fix #53
- update deps:
[compojure "1.3.1"] is available but we use "1.2.1"
[metosin/ring-swagger "0.15.0"] is available but we use "0.14.1"
[peridot "0.3.1"] is available but we use "0.3.0"
- fix anonyous Body & Return model naming issue 56 by Michael Blume
- update deps:
[prismatic/schema "0.3.3"] is available but we use "0.3.2"
[metosin/ring-http-response "0.5.2"] is available but we use "0.5.1"
- use
[org.tobereplaced/lettercase "1.0.0"]
for camel-casing (see metosin/compojure-api-examples#1 (comment)) - updated deps:
[metosin/ring-swagger "0.14.1"] is available but we use "0.14.0"
- support for
:form-parameters
, thanks to Thomas Whitcomb - update deps:
[prismatic/plumbing "0.3.5"] is available but we use "0.3.3"
[potemkin "0.3.11"] is available but we use "0.3.8"
[compojure "1.2.1"] is available but we use "1.1.9"
[prismatic/schema "0.3.2"] is available but we use "0.2.6"
[metosin/ring-http-response "0.5.1"] is available but we use "0.5.0"
[metosin/ring-swagger "0.14.0"] is available but we use "0.13.0"
[lein-ring "0.8.13"] is available but we use "0.8.11"
- Fixed #47:
:middlewares
broke route parameters
- Compiled without AOT
- Removed
:yaml-in-html
and:clojure
from default response formats
- Some cleaning
- Requires now clojure 1.6.0 for
clojure.walk
- Requires now clojure 1.6.0 for
- Support other formats in addition to JSON
- Uses the ring-middleware-format to parse requests and encode responses
- Fixes #43: Middlewares added to route with :middlewares shouldn't leak to other routes in same context anymore
- Update to latest
ring-swagger
- Update to latest
ring-swagger
- Fixes #16: If Schema has many properties, they are now shown in correct order on Swagger-UI
hash-map
loses the order if it has enough properties- Use flatland.ordered.map/ordered-map when Schema has many properties and you want to keep the order intact
(s/defschema Thingie (ordered-map :a String ...))
- Fixes #16: If Schema has many properties, they are now shown in correct order on Swagger-UI
- Use latest
ring-swagger
:body
and others no langer take description as third param, instead use:body [body (describe Schema "The description")]
describe
works also for Java classes:query-params [x :- (describe Long "first-param")]
- And inside defschema
(s/defschema Schema {:sub (describe [{:x Long :y String}] "Array of stuff")})
- return model coercion returns
500
instead of400
, thanks to @phadej! - added support for returning primitives, thanks to @phadej!
(GET* "/plus" []
:return Long
:query-params [x :- Long {y :- Long 1}]
:summary "x+y with query-parameters. y defaults to 1."
(ok (+ x y)))
:responses
restructuring to (error) return codes and models, thanks to @phadej!
(POST* "/number" []
:return Total
:query-params [x :- Long y :- Long]
:responses {403 ^{:message "Underflow"} ErrorEnvelope}
:summary "x-y with body-parameters."
(let [total (- x y)]
(if (>= total 0)
(ok {:total (- x y)})
(forbidden {:message "difference is negative"}))))
- support for
s/Uuid
via latestring-swagger
. - fail-fast (with client-typos): remove default implementation from
compojure.api.meta/restructure-param
- restructure
:header-params
(fixes #31) - remove vanilla compojure-examples, internal cleanup
- allow primitives as return types (with help of
[metosin/ring-swagger 0.10.2]
)- all primitives are supported when wrapped into sequences and sets
- directly, only
String
is supported as Ring doesn't support others- in future, there could be a special return value coercer forcing all other primitives as Strings
- first take on removing the global route state => instead of global
swagger
atom, there is one defined+routes+
var per namespace- requires a
compojure.api.core/with-routes
on api root to generate and hold the+routes+
(automatically bundled withdefapi
)
- requires a
- update ring-swagger to
0.10.1
to get support fors/Keyword
as a nested schema key.
- possibly breaking change:
middlewares
macro and:middlewares
restructuring now use thread-first to apply middlewares - update ring-swagger to
0.9.1
with support for vanilaschema.core/defschema
schemas- big internal cleanup, removing model var-resolutions, lot's of internal fn's removed
- added
defroutes
tocompojure.api.legacy
- removed defns from
compojure.api.common
:->Long
,fn->
,fn->>
- cleaner output from
compojure.api.meta/restructure
(doesn't generate emptylets
&letks
)
- added
compojure.api.legacy
ns to have the old Compojure http-method macros (GET
,POST
,...)
- Update dependencies:
[prismatic/plumbing "0.3.1"] is available but we use "0.2.2"
[compojure "1.1.8"] is available but we use "1.1.7"
[prismatic/schema "0.2.3"] is available but we use "0.2.2"
[metosin/ring-swagger "0.8.8"] is available but we use "0.8.7"
[peridot "0.3.0"] is available but we use "0.2.2"
- Really updated ring-swagger dependancy as I forgot that last with previous release
- remove non-first trailing spaces from compojure-routes for swagger-docs.
- updated depedencies:
[metosin/ring-swagger "0.8.7"]
[metosin/ring-swagger-ui "2.6.16-2"]
- Moved swagger-ui handler to ring-swagger
-
updated dependencies:
[compojure "1.1.7"]
[prismatic/schema "0.2.2"]
[metosin/ring-swagger "0.8.5"]
-
consumes
andproduces
are now feed toring-swagger
based on the installed middlewares.
- fix for #19
- change signature of
restructure-param
to receive key, value and the accumulator. Remove the key from accumulator parameters by default. No more alpha. - separate restructuring into own namespace
meta
- new:
:middlewares
restructuring to support adding middlewares to routes:
(DELETE* "/user/:id" []
:middlewares [audit-support (for-roles :admin)]
(ok {:name "Pertti"})))
- breaking change:
with-middleware
is renamed tomiddlewares
& it applies middlewares in reverse order - more docs on creating own metadata DSLs
- use
clojure.walk16
internally
- fixed #12
- added http-kit example
- renamed
clojure.walk
toclojure.walk16
- writing routes to
swagger
atom happens now at runtime, not compile-time. Works with AOT.
- All
compojure.api.core
restructuring are now usingrestructure-param
multimethod to allow external extensions. ALPHA.
- FIXED #9
swaggered
resources are now collected in order
- fixed bug with missing
+compojure-api-request+
when having both compojure descruction & compojure-api desruction in place - added support for
:body-params
(with strict schema):
(POST* "/minus" []
:body-params [x :- Long y :- Long]
:summary "x-y with body-parameters"
(ok {:total (- x y)}))
- update
ring-swagger
to0.8.4
to get better basepath-resolution (with reverse-proxys)
- support for Schema-aware
:path-parameters
andquery-parameters
:
(GET* "/sum" []
:query-params [x :- Long y :- Long]
:summary "sums x & y query-parameters"
(ok {:total (+ x y)}))
(GET* "/times/:x/:y" []
:path-params [x :- Long y :- Long]
:summary "multiplies x & y path-parameters"
(ok {:total (* x y)}))
swagger-ui
index-redirect work also under a context when running in an legacy app-server. Thanks to Juha Syrjälä for the PR.
- use
instanceof?
to match records instead of=
with class. Apps can now be uberwarred withlein ring uberwar
.
- update
ring-swagger
to0.8.3
, generate path-parameters on client side
- update
ring-swagger
to0.8.1
, all json-schema generation now done there.
- coerce return values with smart destructuring, thanks to Arttu Kaipiainen.
- update
ring-http-response
to0.4.0
- handle json-parse-errors by returning json
- rewrite
compojure.api.core-integration-test
usingperidot.core
- Swagger path resolution works now with Compojure regular expression matching in URL parameters. Thanks to Arttu Kaipiainen.
(context "/api" []
(GET* ["/item/:name" :name #"[a-z/]+"] [name] identity))
- Sets really work now with smart destructuring of
GET*
andPOST*
. Addeds tests to verify.
- update
ring-swagger
to0.7.3
- initial support for smart query parameter destructuring (arrays and nested params don't get swagger-ui love yet - but work otherwise ok)
(GET* "/echo" []
:return Thingie
:query [thingie Thingie]
(ok thingie)) ;; here be coerced thingie
- Breaking change:
compojure.api.routes/defroutes
is nowcompojure.api.core/defroutes*
to avoid namespace clashes & promote it's different. - FIXED #4
- reverted "Compojures args-vector is now optional with
compojure.api.core
web methods"
- reverted "Compojures args-vector is now optional with
- removed the Compojure Var pimp. Extended meta-data syntax no longer works with vanilla Compojure but requires the extended macros from
compojure.api.core
. - update to
Ring-Swagger
to0.7.2
- date-format can be overridden in the
json-response-support
, thanks to Dmitry Balakhonskiy - Update
Ring-Swagger
to0.7.1
giving support for nested Maps:
(defmodel Customer {:id String
:address {:street String
:zip Long
:country {:code Long
:name String}}})
- schema-aware body destructuring with
compojure.api.core
web methods does now automatic coercion for the body - Compojures args-vector is now optional with
compojure.api.core
web methods
(POST* "/customer"
:return Customer
:body [customer Customer]
(ok customer))) ;; we have a coerced customer here
- update
ring-swagger
to0.7.0
- support for
schema/maybe
andschema/both
- consume
Date
&DateTime
both with and without millis:"2014-02-18T18:25:37.456Z"
&"2014-02-18T18:25:37Z"
- support for
- name-parameter of
swaggered
is stripped out of spaces.
- update
ring-swagger
to0.6.0
- support for LocalDate.
- updated example to cover all the dates.
swaggered
doesn't have to contain container-element (context
etc.) within, endpoints are ok:
(swaggered "ping"
:description "Ping api"
(GET* "/ping" [] (ok {:ping "pong"})))
- body parameter in
POST*
andPUT*
now allows model sequences:
(POST* "/pizzas" []
:body [pizzas [NewPizza] {:description "new pizzas"}]
(ok (add! pizzas)))
- update
ring-swagger
to0.5.0
to get support for Data & DateTime.
swaggered
can now follow symbols pointing to acompojure.api.routes/defroutes
route definition to allow better route composition.compojure.api.sweet
now usescompojure.api.routes/defroutes
instead ofcompojure.core/defroutes
- Fixed JSON Array -> Clojure Set coarcing with Strings
- Initial public version