We use Break Versioning. The version numbers follow a <major>.<minor>.<patch>
scheme with the following intent:
Bump | Intent |
---|---|
major |
Major breaking changes -- check the changelog for details. |
minor |
Minor breaking changes -- check the changelog for details. |
patch |
No breaking changes, ever!! |
-SNAPSHOT
versions are preview versions for upcoming releases.
:description
and:openapi/description
get used for populating the OpenAPI parameter:description
. #84 metosin/reitit#612
- In addition to keys
:swagger/*
and:openapi/*
contributing to swagger/openapi schemas, you can override the whole swagger/openapi schema with:swagger
or:openapi
:
(require '[schema.core :as s])
(require '[schema-tools.core :as st])
(require '[schema-tools.openapi.core :as openapi])
(openapi/transform (st/schema {:foo s/Num}
{:openapi {:type "string" :format "binary"}})
{})
;; {:type "string", :format "binary"}
- Fix {required,optional}-keys regression #59
- Updated deps:
[prismatic/schema "1.1.12"] is available but we use "1.1.11"
- Both String & JSON Coercion also coerce from keywords. This is useful as map keys are commonly keywordized in ring/http. Fixes #54. Thanks to Mitchel Kuijpers
(stc/coerce
{:1 {:true "1", :false "2"}}
{s/Int {s/Bool s/Any}}
stc/json-coercion-matcher)
; {1 {true "1", false "2"}}
- Keys with
swagger
namespace inst/schema
data contribute to Swagger Schema:
(require '[schema.core :as st])
(require '[schema-tools.core :as st])
(require '[schema-tools.swagger.core :as swagger])
(swagger/transform
(st/schema
s/Str
{:swagger/default "abba"
:swagger/format "email"}))
; {:type "string"
; :format "email"
; :default "abba"}
- Updated deps:
[prismatic/schema "1.1.11"] is available but we use "1.1.9"
- Prevent open-schema killing children (#51)
open-schema
now usess/Keyword
as open key Schema, instead ofs/Any
- New options for handling default values (#25):
schema-tools.coerce/default-key-matcher
which adds missing map keys if they have default values specified.schema-tools.coerce/default-coercion-matcher
has been renamed tostc/default-value-matcher
.default-coercion-matcher
is now a deprecated alias fordefault-value-matcher
.
schema-tools.coerce/default-matcher
combines the effects ofdefault-key-matcher
anddefault-value-matcher
.
- Fix ClojureScript (Closure) warning about reference to global RegExp object.
- Using
js/RegExp
as Schema is no longer supported, instead one should useschema.core/Regex
- Using
schema-tools.core/optional-keys-schema
to make all Map Schema keys optional (recursively)
- Initial support of Schema->Swagger2, ported from ring-swagger with added support for ClojureScript!
- BUGFIX: Works now with ClojureScript 1.10.238
- MapEntry changes in the latest ClojureScript broke
walk
- MapEntry changes in the latest ClojureScript broke
- One Swagger, please.
- BREAKING: Requires now Java1.8 (date coercions using
java.time
) - BREAKING:
Default
record value is nowvalue
, notdefault
, fixes #34 schema-tools.coercion
contains nowjson-coercion-matcher
andstring-coercion-matcher
, ported and polished from Ring-swagger
stc/corce
andstc/coercer
default to(constantly nil)
matcherst/open-schema
transforms all nested Map Schemas to accept any extra keys- Tested also against
[org.clojure/clojurescript "1.9.946"]
&[org.clojure/clojure "1.9.0-beta2"]
- Updated dependencies:
[prismatic/schema "1.1.7"] is available but we use "1.0.5"
[org.clojure/clojurescript "1.9.946"] is available but we use "1.9.562"
- BREAKING:
schema-tools.walk/walk
argument order has been changed to matchclojure.walk/walk
- Add
postwalk
andprewalk
toschema-tools.walk
select-schema
migration helper has been dropped off- Handle defaults via
(st/default Long 1)
&stc/default-coercion-matcher
stc/multi-matcher
for applying multiple coercions for same schemas & values- Use Clojure 1.8 by default, test also with 1.7.0
- Updated dependencies:
[prismatic/schema "1.0.5"] is available but we use "1.0.3"
- Fixed problem with
walk
losing metadata for IMapEntries (or vectors) on Clojure 1.8 - Converted source from Cljx to cljc
- Dropped support for Clojure 1.6
- Updated dependencies:
[prismatic/schema "1.0.3"] is available but we use "1.0.2"
- Fix select-schema bug introduced in 0.6.0: #21
schema-tools.walk
- Added support for
s/constrained
- Added support for
- Updated dependencies:
[prismatic/schema "1.0.2"] is available but we use "1.0.1"
- Fixed
walk
forConditionalSchema
- BREAKING: Supports and depends on Schema 1.0.0
schema-tools.walk
- Added support for walking
Conditional
andCondPre
schemes. - Made sure leaf schemes (such as enum, pred, eq) are walked properly,
i.e.
inner
is not called for them as they don't have sub-schemas. - Added
schema-tools.experimental.walk
which provides support forschema.experimental.abstract-map
- Added support for walking
- Updated dependencies:
[prismatic/schema "1.0.1"] is available but we use "0.4.4"
- fixed
select-schema
WARNING on ClojureScript. - updated dependencies:
[prismatic/schema "0.4.4"] is available but we use "0.4.3"
[org.clojure/clojurescript "1.7.107"] is available but we use "1.7.28"
- new functions in
schema-tools.coerce
(idea by Michael Griffiths & ring-swagger)coercer
to create a coercer, which throws exception if the value can't be coerced to match the schema.coerce
to create and apply a coercer, which throws exception if the value can't be coerced to match the schema.- error
:type
can overridden, defaulting to:schema-tools.coerce/error
- remove
safe-coercer
- new
map-filter-matcher
to strip illegal keys from non-record maps- original code by abp
- breaking:
select-schema
signature and functionality has changed- fn argument order has changed to be consistent with other fns
[schema value]
->[value schema]
[matcher schema value]
->[value schema matcher]
- to help migration: throws ex-info with message
"Illegal argument order - breaking change in 0.5.0."
if second argument is not a schema
- uses schema coercion (
map-filter-matcher
) to drop illegal keys- fixes #4 - works now also with predicate keys
- if a value can't be coerced, Exception is thrown - just like from
schema.core/validate
- fn argument order has changed to be consistent with other fns
(st/select-schema
{:a "a"
:z "disallowed key"
:b "disallowed key"
:x-kikka "x-kikka"
:x-kukka "x-kukka"
:y-kikka "invalid key"}
{(s/pred #(re-find #"x-" (name %)) ":x-.*") s/Any, :a String})
; {:a "a", :x-kikka "x-kikka", :x-kukka "x-kukka"}
(st/select-schema {:beer "ipa" :taste "good"} {:beer (s/enum :ipa :apa)} )
; clojure.lang.ExceptionInfo: Could not coerce value to schema: {:beer (not (#{:ipa :apa} "ipa"))}
; data: {:type :schema.core/error,
; :schema {:beer {:vs #{:ipa :apa}}},
; :value {:beer "ipa", :taste "good"},
; :error {:beer (not (#{:ipa :apa} "ipa"))}}
(require '[schema.coerce :as sc])
(st/select-schema {:beer "ipa" :taste "good"} {:beer (s/enum :ipa :apa)} sc/json-coercion-matcher)
; {:beer :ipa}
select-schema
takes now optional coercion matcher - to coerce values safely in a single sweepor-matcher
- fix for #7
- updated dependencies:
[prismatic/schema "0.4.3"] is available but we use "0.4.2"
[org.clojure/clojurescript "0.0-3297"] is available but we use "0.0-3269"
- meta-data helpers:
schema-with-description
schema-description
,resolve-schema
(clj only),resolve-schema-description
(clj only) - updated dependencies:
[prismatic/schema "0.4.2"] is available but we use "0.4.0"
[codox "0.8.12"] is available but we use "0.8.11"
[org.clojure/clojurescript "0.0-3269"] is available but we use "0.0-3196"
- implemented
assoc
- dissoc away schema-name from meta-data (key
:name
) if the transforming functions have changed the schema.assoc
,dissoc
,select-keys
,assoc-in
,update-in
,dissoc-in
,update
,merge
,optional-keys
,required-keys
- fixes #2
- Added
schema-tools.walk
namespace- Implements
clojure.walk/walk
likewalk
function which knows how to traverse through Schemas.
- Implements
- Updated to
[prismatic/schema "0.4.0"]
- BREAKING:
with-optional-keys
andwith-required-keys
are renamed tooptional-keys
andrequired-keys
and take vector now of keys instead of vararg keys - implemented
merge
,update
- updated deps:
[prismatic/schema "0.3.6"] is available but we use "0.3.3"
[org.clojure/clojurescript "0.0-2740"] is available but we use "0.0-2665"
- ClojureScript tests
- Fixed warning about
Object
on Cljs.