Releases: GREsau/schemars
Releases Β· GREsau/schemars
v1.0.0-alpha.16
Removed (β οΈ breaking changes β οΈ )
- the
enumset1
/enumset
optional dependency has been removed, as itsJsonSchema
impl did not actually match the default serialization format ofEnumSet
(#339)
Changed (β οΈ breaking changes β οΈ )
- MSRV is now 1.70
- The
example
attribute value is now an arbitrary expression, rather than a string literal identifying a function to call. To avoid silent behaviour changes, the expression must not be a string literal where the value can be parsed as a function path - e.g.#[schemars(example = "foo")]
is now a compile error, but#[schemars(example = foo())]
is allowed (as is#[schemars(example = &"foo")]
if you want the the literal string value"foo"
to be the example). - For newtype variants of internally-tagged enums, prefer referencing the inner type's schema via
$ref
instead of always inlining the schema (#355)
v1.0.0-alpha.15
Added
SchemaSettings
now has acontract
field which determines whether the generated schemas describe how types are serialized or deserialized. By default, this is set toDeserialize
, as this more closely matches the behaviour of previous versions - you can change this toSerialize
to instead generate schemas describing the type's serialization behaviour (#48 / #335)
Changed
- Schemas generated for enums with no variants will now generate
false
(or equivalently{"not":{}}
), instead of{"enum":[]}
. This is so generated schemas no longer violate the JSON Schema spec's recommendation that a schema'senum
array "SHOULD have at least one element".
v1.0.0-alpha.14
Added
- Read
#[garde(...)]
attributes as an alternative to#[validate(...)]
(#233 / #331). See the documentation for a full list of supported attributes.
v1.0.0-alpha.13
Fixed
- Fix compile errors when using
#[validate(regex(path = *expr))]
attribute
v1.0.0-alpha.12
Fixed
- Allow
regex(path = ...)
value to be a non-string expression (#302 / #328) - Respect
#[serde(rename_all_fields = ...)]
attribute (#273 / #304)
Changed (β οΈ possibly-breaking changes β οΈ )
- Invalid attributes that were previously silently ignored (e.g. setting
schema_with
on structs) will now cause compile errors - Validation attribute parsing has been altered to match the latest version of the validator crate:
- Remove the
phone
attribute - Remove the
required_nested
attribute regex
andcontains
attributes must now be specified in list form#[validate(regex(path = ...))]
rather than name/value form#[validate(regex = ...)]
- Remove the