Skip to content

Releases: GREsau/schemars

v0.8.6

26 Sep 17:44
Compare
Choose a tag to compare

Changed:

  • Use oneOf instead of anyOf for enums when possible (#108)

v0.8.5

20 Sep 16:00
Compare
Choose a tag to compare

Fixed:

  • Allow fields with plain #[validate] attributes (#109)

v0.8.4

19 Sep 09:47
Compare
Choose a tag to compare

Added:

  • #[schemars(schema_with = "...")] attribute can now be set on enum variants.
  • Deriving JsonSchema will now take into account #[validate(...)] attributes, compatible with the validator crate (#78)

v0.8.3

05 Apr 20:15
Compare
Choose a tag to compare

Added:

  • Support for #[schemars(crate = "...")] attribute to allow deriving JsonSchema when the schemars crate is aliased to a different name (#55 / #80)
  • Implement JsonSchema for bytes::Bytes and bytes::BytesMut (#68)

Fixed:

  • Fix deriving JsonSchema on types defined inside macros (#59 / #66 / #79)

v0.8.2

27 Mar 00:17
Compare
Choose a tag to compare

Added:

  • Enable generating a schema from any serializable value using schema_for_value!(...) macro or SchemaGenerator::root_schema_for_value()/SchemaGenerator::into_root_schema_for_value() methods (#75)
  • #[derive(JsonSchema_repr)] can be used on C-like enums for generating a serde_repr-compatible schema (#76)
  • Implement JsonSchema for url::Url (#63)

v0.8.1

23 Mar 20:20
Compare
Choose a tag to compare

Added:

  • SchemaGenerator::definitions_mut() which returns a mutable reference to the generator's schema definitions
  • Implement JsonSchema for slices

Changed:

  • Minimum supported rust version is now 1.37.0
  • Deriving JsonSchema on enums now sets additionalProperties to false on generated schemas wherever serde doesn't accept unknown properties. This includes non-unit variants of externally tagged enums, and struct-style variants of all enums that have the deny_unknown_fields attribute.
  • Schemas for HashSet and BTreeSet now have uniqueItems set to true (#64)

Fixed

  • Fix use of #[serde(transparent)] in combination with #[schemars(with = ...)] (#67)
  • Fix clippy field_reassign_with_default warning in schemars_derive generated code in rust <1.51 (#65)
  • Prevent stack overflow when using inline_subschemas with recursive types

v0.8.0

27 Sep 10:04
Compare
Choose a tag to compare

Added:

  • visit::Visitor, a trait for updating a schema and all schemas it contains recursively. A SchemaSettings can now contain a list of visitors.
  • into_object() method added to Schema as a shortcut for into::<SchemaObject>()
  • Preserve order of schema properties under preserve_order feature flag (#32)
  • SchemaGenerator::take_definitions() which behaves similarly to the now-removed into_definitions() method but without consuming the generator
  • SchemaGenerator::visitors_mut() which returns an iterator over a generator's settings's visitors
  • SchemaSettings::inline_subschemas - enforces inlining of all subschemas instead of using references (#44)

Removed (BREAKING CHANGES):

  • SchemaSettings::bool_schemas - this has been superseded by the ReplaceBoolSchemas visitor
  • SchemaSettings::allow_ref_siblings - this has been superseded by the RemoveRefSiblings visitor
  • SchemaSettings no longer implements PartialEq
  • SchemaGenerator::into_definitions() - this has been superseded by SchemaGenerator::take_definitions()

Changed:

  • BREAKING CHANGE Minimum supported rust version is now 1.36.0

Fixed:

  • BREAKING CHANGE unknown items in #[schemars(...)] attributes now cause a compilation error (#18)

v0.7.6

17 May 17:38
Compare
Choose a tag to compare

Added:

  • #[schemars(example = "...")] attribute for setting examples on generated schemas (#23)

v0.7.5

17 May 12:48
Compare
Choose a tag to compare

Added:

  • Setting #[deprecated] attribute will now cause generated schemas to have the deprecated property set to true
  • Respect #[serde(transparent)] attribute (#17)
  • #[schemars(title = "...", description = "...")] can now be used to set schema title/description. If present, these values will be used instead of doc comments (#13)

Changed:

  • schemars_derive is now an optional dependency, but included by default

v0.7.4

16 May 11:30
Compare
Choose a tag to compare

Added:

  • If a struct is annotated with #[serde(deny_unknown_fields)], generated schema will have additionalProperties set to false (#30)
  • Set type property to string on simple enums (#28)