Releases: GREsau/schemars
Releases · GREsau/schemars
v1.0.0-alpha.17
Changed
- For newtype variants of internally-tagged enums, prefer referencing the inner type's schema via
$ref
instead of always inlining the schema (#355)
N.B. this change was included in the release notes for 1.0.0-alpha.16, but due to a publishing error, was accidentally excluded from the published crate
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 viaDue to a publishing error, this change wasn't actually included in the published crate - this change was instead released in 1.0.0-alpha.17$ref
instead of always inlining the schema (#355)
Fixed
- The "deserialize" schema for
bytes::Bytes
/BytesMut
now allows strings, matching the actual deserialize behaviour of the types. - The schema for
either::Either
now matches the actual serialize/deserialize behaviour of that type.
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