- Support for
schema.core/defrecords
, fixes #103. - Support for primitives & arrays of primitives both in
:body
&:response
.- Replaces #56
- Fixes #55
- Fixes compojure-api/#177
- Thanks to Tim Gilberd for the initial fix!
- Support for top-level Schema-records for non-body-parameters, fixes #104.
- Thanks to quimrstorres!
- Fixed to work with the latest Clojure 1.9 alpha, thanks to Brent Hagany
- Support for
org.joda.time.LocalTime
, thanks to Francesco Bellomi!
[cheshire "5.6.3"] is available but we use "5.6.1"
[metosin/ring-http-response "0.8.0"] is available but we use "0.7.0"
[metosin/scjsv "0.3.0"] is available but we use "0.2.0"
[prismatic/schema "1.1.3"] is available but we use "1.1.2"
[frankiesardo/linked "1.2.7"] is available but we use "1.2.6"
- Map-schema swagger-metadata is set to target schema-object, not for the
$ref
of it, fixes #96. - Better support for additional json-schema meta-data via
ring.swagger.json-schema/field
:
(s/defschema Required
(rsjs/field
{:name s/Str
:title s/Str
:address (rsjs/field
(rsjs/field s/Str {:description "description here"})
{:description "Streename"
:example "Ankkalinna 1"})}
{:minProperties 1
:description "I'm required"
:example {:name "Iines"
:title "Ankka"}}))
-
Better support for nillable fields via
x-nullable
standard hack, fixes fixes #97 -
updated dependencies:
[metosin/ring-http-response "0.7.0"] is available but we use "0.6.5"
[prismatic/schema "1.1.2"] is available but we use "1.1.1"
[clj-time "0.12.0"] is available but we use "0.11.0"
-
Response headers are mapped correctly, Fixes metosin/compojure-api#232.
-
updated dependencies:
[prismatic/schema "1.1.1"] is available but we use "1.1.0"
ring.swagger.core/with-named-subschemas
retains metadata, fixes metosin/compojure-api#168
- update dependencies:
[prismatic/schema "1.1.0"] is available but we use "1.0.5"
[cheshire "5.6.1"] is available but we use "5.5.0"
[prismatic/plumbing "0.5.3"] is available but we use "0.5.2"
- updated dependencies:
[metosin/schema-tools "0.9.0"] is available but we use "0.8.0"
-
Use strings instead of keywords in
:in
, fixes #88, thanks to https://github.com/preoctopus for the fix. -
experimental
ring.swagger.swagger2-full-schema/Swagger
for validating the ring-swagger spec in Clojure -
updated dependencies:
[prismatic/schema "1.0.5"] is available but we use "1.0.4"
[metosin/schema-tools "0.8.0"] is available but we use "0.7.0"
- Closed Map Schemas (e.g.
s/find-extra-keys-schema
returning nil) will have:additionalProperties
set tofalse
. - Path-parameters are always required (in align to the spec)
- Body-parameters are not required if wrapped in
schema.core.Maybe
ring.swagger.coerce/query-coercions
now apply both:json
and:query
coercions fors/Int
,Long
andDouble
- Cleaned up internals
ring.swagger.swagger2/transform
->ring.swagger.json-schema/schema-object
-
Fixed generating Swagger path templates in cases where path parameter is followed by an extension (#82)
-
Make the JSON Schema validator public:
ring.swagger.validator/validate
.
(require '[ring.swagger.validator :as v])
(v/validate (rs/swagger-json {:paths {"/api/ping" {:get nil}}}))
; nil
(v/validate (rs/swagger-json {:pathz {"/api/ping" {:get nil}}}))
; ({:level "error"
; :schema {:loadingURI "#", :pointer ""}
; :instance {:pointer ""}
; :domain "validation"
; :keyword "additionalProperties"
; :message "object instance has properties which are not allowed by the schema: [\"pathz\"]", :unwanted ["pathz"]})
- Discard all extra map keys from properties (#77)
- All Schema extra keys
are now exposed as Swagger additional properties.
- Previously only
s/Keyword
were supported.
- Previously only
- Fix JSON Schema
nil
default value (#79) - Updated dependencies:
[prismatic/schema "1.0.4"] is available but we use "1.0.3"
[potemkin "0.4.3"] is available but we use "0.4.1"
- Generate
(s/maybe s/Str)
-parameters ofs/Any
for non-body-parameters. Fixes #74. - Mappings for
s/Symbol
&s/Inst
- Use
:default
metadata ofoptional-key
s set by Plumbing for Swagger propertydefault
field.
[prismatic/plumbing "0.5.2] is available but we use "0.5.1"
- BREAKING: Dropped support for Clojure 1.6
- BREAKING: Supports and depends on Schema 1.0.
- Uses now linked instead of ordered for maps where order matters
- Fixed #64, use first found schema name to be consistent with Json Schema.
- Fixed #67
swagger-ui
now supports passing arbitrary options toSwaggerUI
- updated dependencies:
[metosin/schema-tools "0.7.0"] is available but we use "0.5.2"
[prismatic/schema "1.0.3"] is available but we use "0.4.4"
[prismatic/plumbing "0.5.1"] is available but we use "0.4.4"
-
BREAKING: Swagger 1.2 is no more supported.
-
BREAKING:
ring.swagger.json-schema/json-type
multimethod is removed- will cause compile-time errors for those who have client-side custom extensions
- new way of doing the Schema -> Swagger Schema mappings:
- Classes via
ring.swagger.json-schema/convert-class
multimethod, taking both the class and swagger options - Objects (e.g. records) via
ring.swagger.json-schema/JsonSchema
protocol.
- Classes via
-
lot's of internal cleanup in
ring.swagger.json-schema
:->json
is now->swagger
and takes options map instead of kwargs.- removed option
:top
(required only for Swagger 1.2) - new option
:in
denote the parameter type (:query
,:header
,:path
,:formData
or:body
)- responses don't have
:in
.
- responses don't have
-
Support for collections in query and form parameters (even with single parameter):
- Parameters
{:query {:x [Long]}}
withring.middleware.params/wrap-params
middleware and query-string ofx=1&x=2&x?3
withring.swagger.schema/coercer!
should result inx
being[1 2 3]
- Same with Compojure-api:
:query-params [x :- [Long]]
- Same with Compojure-api:
- For now, only supports collectionFormat
multi
.
- Parameters
-
(From compojure-api) Support for file uploads.
ring.swagger.upload/TempFileUpload
andByteArrayUpload
Schemas to be used withring.middleware.multipart-params
default stores.
-
support for
schema.core.One
by Steffen Dienst. -
:version
is not mandatory field in ring-swagger schema (defaults to0.0.1
) -
new public api fns in
ring.swagger.swagger2
:transform-operations
for generic operation transformations on the client sideensure-body-and-response-schema-names
to fix the generated schema names on the client side (vs. theswagger-json
generating new names for all the requests.
-
Fixes 54:
:paths
order is now preserved- use
flatland.ordered.map/ordered-map
in the client side to keep the order.
- use
-
updated dependencies:
[metosin/schema-tools "0.5.2"] is available but we use "0.4.1"
[metosin/ring-http-response "0.6.5"] is available but we use "0.6.2"
[metosin/ring-swagger-ui "2.1.2"] is available but we use "2.0.24"
[prismatic/schema "0.4.4"] is available but we use "0.4.3"
[cheshire "5.5.0"] is available but we use "5.4.0"
[org.flatland/ordered "1.5.3"] is available but we use "1.5.2"
[clj-time "0.11.0"] is available but we use "0.9.0"
[potemkin "0.4.1"] is available but we use "0.3.13"
- dev-dependencies:
[lein-ring "0.9.6"] is available but we use "0.9.4"
[funcool/codeina "0.3.0"] is available but we use "0.1.0"
[midje "1.7.0"] is available but we use "1.7.0-SNAPSHOT"
ring.swagger.swagger2/transform-paths
for generic endpoint tranformations.- updated dependencies:
[metosin/schema-tools "0.4.1"] is available but we use "0.4.0"
[metosin/ring-http-response "0.6.2"] is available but we use "0.6.1"
[prismatic/schema "0.4.3"] is available but we use "0.4.2"
[prismatic/plumbing "0.4.4"] is available but we use "0.4.3"
- removed dependency:
[instar "1.0.10" :exclusions [org.clojure/clojure com.keminglabs/cljx org.clojure/clojurescript]]]
- new option
:handle-duplicate-schemas-fn
to handle duplicates schemas.- breaking: default behaviour is "take the first definition" instead of
IllegalArgumentException
(the code was broken, did not work with anonymous predicate schemas & regexps.
- breaking: default behaviour is "take the first definition" instead of
- updated deps:
[prismatic/plumbing "0.4.3"] is available but we use "0.4.2"
[lein-ring "0.9.4"] is available but we use "0.9.3"
- add
:type "object"
to Swagger 2.0 Definitions, requested by Ron. - Middlewares can define extra swagger data, set into a request, read out by swagger-docs
- setting data via
set-swagger-data
, reading data viaget-swagger-data
. wrap-swagger-data
middleware for easy publishing of swagger-data.
- setting data via
- updated dependencies:
[prismatic/schema "0.4.2"] is available but we use "0.4.1"
swagger-json
now handlesnil
options, thanks to Frankie Sardo.- updated dependencies:
[prismatic/schema "0.4.1"] is available but we use "0.4.0"
- welcome back the
Info
schema inring.swagger.swagger2-schema
! - ring-swagger defaults in
swagger-json
are deep-merged in instead of plain merge. - breaking: default spec-location has changed from
/api/api-docs
to/swagger.json
in `ring.swagger.ui
- initial support for
additionalProperties
vias/Keyword
-key in the schemas. Thanks for Juan Patten for the initial code.
- throw
IllegalArgumentException
if multiple different schemas have a same name. Fixes #39 - drop import of
javax.servlet ServletContext
, causing reflection on Servlet Apps. - updated dependencies:
[prismatic/plumbing "0.4.2"] is available but we use "0.4.1"
[metosin/schema-tools "0.4.0"] is available but we use "0.3.0"
- minify Ring-Swagger 2.0 Schema - just the essentials
- Swagger2.0 JSON Schema is now in classpath
ring/swagger/v2.0_schema.json
- exclude ill transitive dependencies from Instar (cljx, cljs)
- use ~1000x faster JSON Schema validator in tests:
[metosin/scjsv "0.2.0"] is available
:resourcePath
is now set correctly with Swagger 1.2 endpoints (fixes #36.
- avoid reflection with regexps, thanks to Michael Blume
- default 2.0 responses don't have schemas
- support for walking over Schema predicates support for 1.2 too
with-named-sub-schemas
takes an optional parameter - prefix for schema names- Schema-names are now generated as String instead of Keywords in the swagger-json 2.0
- uses
[metosin/schema-tools "0.3.0]
to walk over Schema records both to fetch schema names and give names to subschemas (Swagger 2.0 only)- see tests - in the end of the file
[lein-ring "0.9.3"] is available but we use "0.9.2"
with-named-sub-schemas
has learned how to add names to schemas insides/maybe
and others- This means that you can now use inline schemas inside
s/maybe
- This means that you can now use inline schemas inside
- updated deps:
[prismatic/schema "0.4.0"] is available but we use "0.3.7"
[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"
[metosin/ring-http-response "0.6.1"] is available but we use "0.6.0"
- Fixed compatibility with Schema 0.4.0
- Fixed wrap-validation-errors defaults
- fixed Swagger 2.0 response bug #29
ring.swagger.swagger2/swagger-json
now takes an optional extra argument, the Options-map with options:ignore-missing-mappings?
&:default-response-description-fn
- ensured that ignoring missing mappings works for both body- & non-body parameters
- BREAKING:
- moved binding of
s/either
fromring.swagger.json-schema-dirty
toring.swagger.json-schema
. Uses the first schema element as the source for the mappings ring.swagger.middleware/wrap-validation-error
takes now options as a single map
- moved binding of
- updated deps:
[metosin/ring-http-status "0.6.0"] is available but we use "0.5.2"
[prismatic/schema "0.3.7"] is available but we use "0.3.3"
[prismatic/plumbing "0.3.7"] is available but we use "0.3.5"
[lein-ring "0.9.2"] is available but we use "0.9.1"
- revert default spec location to
/api/docs
to be more backwards compatible. Swagger2-clients should useswagger.json
. ring.swagger.middleware/comp-mw
to make middleware parametrization easier:
(def wrap-swagger2-ui
(comp-mw wrap-swagger-ui :swagger-docs "swagger.json"))
- Swagger 2.0 support!!
- new namespace
ring.swagger.swagger2
with clean public API with Schemas
- new namespace
- breaking change: default spec location changed from
/api/docs
to/swagger.json
(2.0 standard) - breaking change: in
ring.swagger.middleware
thecatch-validation-error
is nowwrap-validation-error
- takes an extra option:
:error-handler
to allow error response customization &:catch-core-errors?
for catching:schema.core/error
s (defaults tofalse
).
- takes an extra option:
- one can now plug own coercers for
coerce
andcoerce!
- use real swagger json schema validator for tests (
ring.swagger.validator
) - potential breaking changes for library developers due massive refactoring
- support for Regexp schemas:
java.util.regex Pattern
/s/Regex
(as a class)#"^[a-9]$"
(as a instance)
- support for 1.2 spec
authorization
parameters by Dmitry Groshev - oauth2-configs for swagger-ui by Dmitry Groshev
- updated dependencies:
[cheshire "5.4.0"] is available but we use "5.3.1"
[clj-time "0.9.0"] is available but we use "0.8.0"
*[metosin/ring-swagger-ui "2.0.24"] is available but we use "2.0.17"
*[com.github.fge/json-schema-validator "2.2.6"] is available but we use "2.2.5"
*[lein-ring "0.9.1"] is available but we use "0.8.13"
[instar "1.0.10"]
- new feature: binding dynamic variable
ring.swagger.json-schema/*ignore-missing-mappings*
to true will cause unknown json-schema mappings to be ignored - fixed #42
- updated dependencies:
[metosin/ring-http-response "0.5.2"] is available but we use "0.5.1"
[prismatic/schema "0.3.3"] is available but we use "0.3.2"
[ring/ring-core "1.3.2"] is available but we use "1.3.1"
- support for
s/Named
- use
[org.tobereplaced/lettercase "1.0.0"]
in favour of[camel-snake-kebab "0.2.5"]
- update deps:
[prismatic/schema "0.3.2"] is available but we use "0.3.1"
- support for
java.lang.Number
,java.lang.Integer
,s/Num
- Updated deps:
[slingshot "0.12.1"] is available but we use "0.12.0"
[metosin/ring-http-response "0.5.1"] is available but we use "0.5.0"
[prismatic/plumbing "0.3.5"] is available but we use "0.3.4"
[camel-snake-kebab "0.2.5"] is available but we use "0.2.4"
[potemkin "0.3.11"] is available but we use "0.3.10"
[lein-ring "0.8.13"] is available but we use "0.8.11"
[prismatic/schema "0.3.1"] is available but we use "0.2.6"
- Updated dependencies
- camel-snake-kebab 0.2.0 renamed the ns
camel-snake-kebab
tocamel-snake-kebab.core
- camel-snake-kebab 0.2.0 renamed the ns
ring.swagger.json-schema-dirty
namespace now provides experimental implementation fors/if
,s/conditional
ands/either
Schema transformations.- Fixed a bug with
s/recursive
- Should now keep order of properties in Schemas if using
ordered-map
- Use
ordered-map
from flatland.ordered.map (s/defschema (ordered-map :a String ...))
- Use
- Removed
ring.swagger.schema/defmodel
, please useschema.core/defschema
. - Split JSON Schema generation to a
json-schema
module. - Refactored Json schema transformations
- New
describe
helper:- Instead of
(field Long {:description "The description"})
you can use (describe Long "The description")
- Instead of
- New
ring.swagger.ui/swagger-ui
always set content-type ofapplication/javascript
forconf.js
ring.swagger.ui/wrap-swagger-ui
to package swagger-ui as middleware.- updated deps:
[prismatic/plumbing "0.3.3"] is available but we use "0.3.2"
[metosin/ring-swagger-ui "2.0.17"] is available but we use "2.0.16-3"
2 artifacts were upgraded.
- support for
s/Uuid
, thanks to @phadej!
- support for
header
-params. - change
s/defn
to `sm/defn, might fix #12 (plumatic/schema#21)
- allow primitives as return types (fixes #9)
- fix bug: with-named-sub-schemas does not fail with
s/Keyword
s. - updated deps:
[prismatic/schema "0.2.4"] is available but we use "0.2.3"
[prismatic/plumbing "0.3.2"] is available but we use "0.3.1"
[lein-ring "0.8.11"] is available but we use "0.8.10"
- support for ResponseModels
- support for
s/Any
(maps tovoid
as a return type, fields of this type are ignored) - support for
s/Keyword
(or any otherschema.core.Predicate
) as a key -> fields are ignored
- 'cos the deployment of
0.9.0
failed to clojars
defmodel
with nested anonymous submodels works now with AOTdefmodel
doesn't contain themodel
metadata -> removed all the model var-resolutions- support for vanilla
schema.core/defschema
s as the models - update to use `[ring "1.3.0"]
defmodel
now supports anonymous maps within valid containers (set
,list
,vector
)
(require '[ring.swagger.schema :refer :all])
(require '[ring.swagger.core :refer [transform]])
(defmodel Items {:data [{:id Long
:name String}]})
Items
;; {:data [{:name java.lang.String, :id java.lang.Long}]}
ItemsData
;; {:name java.lang.String, :id java.lang.Long}
(transform Items)
;; {:properties {:data {:items {:$ref "ItemsData"}, :type "array"}}, :required [:data]}
(transform ItemsData)
;; {:properties {:name {:type "string"}, :id {:type "integer", :format "int64"}}, :required [:name :id]}
- Added type hints where
lein check
suggested - Added swagger-ui tests for multiple envinronments
- Fixed swagger-ui for servlet envinronment
- new
ring.swagger.ui
-ns providedswagger-ui
function which can be used to create ring handler to serve Swagger-ui. - updated clojure dependency
- both
consumes
andproduces
can be set by the client side for the api declaration.
- updated docs
strict-schema
andloose-schema
extract-basepath
renamed tobasepath
, understands the:servlet-context
and headerx-forwarded-proto
- fix bug in
string-path-parameters
- path parameters are not set implicitly, clients can use
(string-path-parameters url)
to create those automatically
- json schema transformations are now all multimethod-based.
- support for
s/eq
- support for
nil
type-of
andreturn-type-of
are removed in favour of->json
.- Route uri is passed as a String (
/api/users/:id
) instead of a Vector (["/api/users/" :id]
) - Parameters are passed in Schema-format, not as Json Schema
resolve-model-vars
uses Walking to preserve the original collection form (Sets)return-type-of
preserves Sets.
- support for Recursive Models (
s/recursive
), thanks to Arttu Kaipiainen! - coersion has now two modes:
:json
and:query
, latter converts strings to Longs, Doubles and Booleans
- sub-models don't have
_
to split up classes.Customer_Address
->CustomerAddress
. Looks good.
defmodel
now supports nested maps (by generating sub-types)
(defmodel Customer {:id String
:address {:street String
:zip Long
:country {:code Long
:name String}}})
;; Customer => {:id java.lang.String, :address {:street java.lang.String, :zip java.lang.Long, :country {:name java.lang.String, :code java.lang.Long}}}
;; Customer_Address => {:street java.lang.String, :zip java.lang.Long, :country {:name java.lang.String, :code java.lang.Long}}
;; Customer_Address_Country => {:name java.lang.String, :code java.lang.Long}
- support for
s/maybe
ands/both
- consume
Date
&DateTime
both with and without millis:"2014-02-18T18:25:37.456Z"
&"2014-02-18T18:25:37Z"
- updated docs
- more tests
- Model, serialization and coercion support for
org.joda.time.LocalDate
- Supports now model sequences in (body) parameters
- Model, serialization and coercion support for
java.util.Date
andorg.joda.time.DateTime
- Fixed JSON Array -> Clojure Set coercion with Strings
- Initial public version