Skip to content

Releases: GREsau/schemars

v1.0.0-alpha.17

02 Dec 22:25
Compare
Choose a tag to compare
v1.0.0-alpha.17 Pre-release
Pre-release

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

25 Nov 10:46
Compare
Choose a tag to compare
v1.0.0-alpha.16 Pre-release
Pre-release

Removed (⚠️ breaking changes ⚠️)

  • the enumset1/enumset optional dependency has been removed, as its JsonSchema impl did not actually match the default serialization format of EnumSet (#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) Due 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

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

05 Sep 12:04
Compare
Choose a tag to compare
v1.0.0-alpha.15 Pre-release
Pre-release

Added

  • SchemaSettings now has a contract field which determines whether the generated schemas describe how types are serialized or deserialized. By default, this is set to Deserialize, as this more closely matches the behaviour of previous versions - you can change this to Serialize 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's enum array "SHOULD have at least one element".

v1.0.0-alpha.14

29 Aug 16:30
Compare
Choose a tag to compare
v1.0.0-alpha.14 Pre-release
Pre-release

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

27 Aug 18:29
Compare
Choose a tag to compare
v1.0.0-alpha.13 Pre-release
Pre-release

Fixed

  • Fix compile errors when using #[validate(regex(path = *expr))] attribute

v1.0.0-alpha.12

27 Aug 18:16
Compare
Choose a tag to compare
v1.0.0-alpha.12 Pre-release
Pre-release

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 and contains attributes must now be specified in list form #[validate(regex(path = ...))] rather than name/value form #[validate(regex = ...)]

v1.0.0-alpha.11

24 Aug 13:59
Compare
Choose a tag to compare
v1.0.0-alpha.11 Pre-release
Pre-release

Changed

  • Values in #[doc = ...] and #[schemars(description = ..., title = ...)] attributes may now be any arbitrary expression rather than just string literals. (#204 / #327)
  • ⚠️ MSRV is now 1.65 ⚠️

v1.0.0-alpha.10

22 Aug 19:04
Compare
Choose a tag to compare
v1.0.0-alpha.10 Pre-release
Pre-release

Fixed

  • Fix some cases of unsatisfiable schemas generated when flattening enums (#325 / #164 / #165)

v1.0.0-alpha.9

22 Aug 19:04
Compare
Choose a tag to compare
v1.0.0-alpha.9 Pre-release
Pre-release

Added

  • Add rustdoc for derive(JsonSchema) macro (#322 / #322)

v1.0.0-alpha.8

21 Aug 15:21
Compare
Choose a tag to compare
v1.0.0-alpha.8 Pre-release
Pre-release

Changed

  • Replace schemars::gen module with schemars::generate. This is because gen is a reserved keyword in rust 2024, so can only be used as r#gen. The schemars::gen module is still available for ease of upgrading, but is marked as deprecated and may be removed in the future 1.0.0 release. (#306 / #323)