schemars
Generate JSON Schemas from Rust code
1.2.2
412M downloads/mo
#278 most downloaded on crates.io
GREsau/schemars
What this package is like to depend on
Last release 27 days ago
27 Jul 2026
Release timing varies
gaps range from 8 days to 6 months
Most releases are documented
notes for 49 of 64 stable releases
Nothing withdrawn
no release was ever pulled
7 years old
97 releases · first in 2019
5 releases in the last 12 months
see the full history below
Release timeline
97 releases · Aug 2019 to Jul 2026Releases
latest 60 of 97-
1.2.227 Jul 2026 -
1.2.101 Feb 2026Release notes
Open source →Fixed
transformattributes are now applied after the schema is otherwise fully constructed. In particular, they're now applied after all other attributes are processed. (#505)
Release notes
Open source →Fixed
transformattributes are now applied after the schema is otherwise fully constructed. In particular, they're now applied after all other attributes are processed. (https://github.com/GREsau/schemars/issues/505)
-
1.2.025 Dec 2025Release notes
Open source →🎅 Merry Christmas! 🎄
Added
- Add smol_str03 feature (#486)
Changed
- Schemas generated for
HashMap/BTreeMapwith enum keys are now more specific (#452)
Release notes
Open source →Added
- Add smol_str03 feature (https://github.com/GREsau/schemars/pull/486)
Changed
- Schemas generated for
HashMap/BTreeMapwith enum keys are now more specific (https://github.com/GREsau/schemars/pull/452)
-
1.1.005 Nov 2025Release notes
Open source →Added
- Public functions that have no side-effects are now marked with
#[must_use]so that they report a lint warning when the returned value is unused, as this likely indicates a mistake.
Fixed
Release notes
Open source →Added
- Public functions that have no side-effects are now marked with
#[must_use]so that they report a lint warning when the returned value is unused, as this likely indicates a mistake.
Fixed
- Improve accuracy of schemas for flattened enums, in particular: unit variants of externally-tagged enums, and enums wrapped in
Option<>. (https://github.com/GREsau/schemars/issues/464 / https://github.com/GREsau/schemars/pull/483)
- Public functions that have no side-effects are now marked with
-
1.0.502 Nov 2025Release notes
Open source →Fixed
- Fix
schema.pointer_mut()to resolve URI fragment identifiers like#/$defs/foo, matching current behaviour ofschema.pointer()(https://github.com/GREsau/schemars/issues/478 / https://github.com/GREsau/schemars/pull/479)
- Fix
-
1.0.406 Jul 2025Release notes
Open source →Fixed
- Fix
JsonSchemaimpl on atomic types being ignored on non-nightly compilers due to a buggycfgcheck (https://github.com/GREsau/schemars/issues/453) - Fix compatibility with minimal dependency versions, e.g. old(-ish) versions of
syn(https://github.com/GREsau/schemars/issues/450) - Fix derive for empty tuple variants (https://github.com/GREsau/schemars/issues/455)
- Fix
-
1.0.328 Jun 2025Release notes
Open source →Fixed
- Fix compile error when a doc comment is set on both a
transparent(or newtype) struct and its field (https://github.com/GREsau/schemars/issues/446) - Fix
json_schema!()macro compatibility when used from pre-2021 rust editions (https://github.com/GREsau/schemars/pull/447)
- Fix compile error when a doc comment is set on both a
-
1.0.226 Jun 2025Release notes
Open source →Fixed
- Fix schema properties being incorrectly reordered during serialization (#444)
Release notes
Open source →Fixed
- Fix schema properties being incorrectly reordered during serialization (https://github.com/GREsau/schemars/issues/444)
-
1.0.124 Jun 2025Release notes
Open source →Fixed
- Deriving
JsonSchemawithno_stdbroken due tostd::borrow::ToOwnedtrait not being in scope (#441)
Release notes
Open source →Fixed
- Deriving
JsonSchemawithno_stdbroken due tostd::borrow::ToOwnedtrait not being in scope (https://github.com/GREsau/schemars/issues/441)
- Deriving
-
1.0.023 Jun 2025Release notes
Open source →This is a major release with many additions, fixes and changes since 0.8 (but not many since 0.9). While the basic usage (deriving
JsonSchemaand usingschema_for!()orSchemaGenerator) is mostly unchanged, you may wish to consult the migration guide which covers some of the most significant changes.Changes since 1.0.0-rc.2:
Added
#[schemars(bound = ...)]attributes are now used from fields as well as containers- The
Schema::pointer(...)method now works when given a JSON pointer in URI Fragment representation with a leading#character. In particular, this means that you can now lookup a schema from a$refvalue using that method.
Fixed
Release notes
Open source →This is a major release with many additions, fixes and changes since 0.8 (but not many since 0.9). While the basic usage (deriving
JsonSchemaand usingschema_for!()orSchemaGenerator) is mostly unchanged, you may wish to consult the migration guide which covers some of the most significant changes.Changes since 1.0.0-rc.2:
Added
#[schemars(bound = ...)]attributes are now used from fields as well as containers- The
Schema::pointer(...)method now works when given a JSON pointer in URI Fragment representation with a leading#character. In particular, this means that you can now lookup a schema from a$refvalue using that method.
Fixed
- Schema names that contain special characters are now correctly encoded when used inside a
$refvalue (https://github.com/GREsau/schemars/pull/436) - Optimise type param usage in
SchemaGenerator::subschema_for, reducing LLVM line count and improving compile times (https://github.com/GREsau/schemars/pull/439)
-
1.0.0-rc.219 Jun 2025 pre-releaseRelease notes
Open source →Added
- Serde attributes that you want schemars to ignore can now be "unset" by including them in a schemars attribute with a ! prefix, e.g.
#[schemars(!from)](https://github.com/GREsau/schemars/issues/433 / https://github.com/GREsau/schemars/pull/434)
Removed
- ⚠️ Deprecated items have been removed:
SchemaSettings::option_nullableandSchemaSettings::option_add_null_typefieldsgenmodule
- Serde attributes that you want schemars to ignore can now be "unset" by including them in a schemars attribute with a ! prefix, e.g.
-
1.0.0-rc.116 Jun 2025 pre-releaseRelease notes
Open source →Added
- Impl
JsonSchemaforchrono::TimeDelta(https://github.com/GREsau/schemars/issues/357) - Support
with/into/from/try_fromcontainer attributes (https://github.com/GREsau/schemars/issues/210 / https://github.com/GREsau/schemars/issues/267)
Changed
- Use
oneOfwhen generating schema for serialized mixed-type sequences (https://github.com/GREsau/schemars/issues/348) - the previous behaviour was to always usetrueschema (i.e. any value) for mixed-type sequences
- Impl
-
1.0.0-alpha.2212 Jun 2025 pre-releaseRelease notes
Open source →Added
- Type and const generic params can now be used in
schema_withattributes, e.g.#[schemars(schema_with = "func::<T>")](https://github.com/GREsau/schemars/pull/426 / https://github.com/GREsau/schemars/issues/375)
- Type and const generic params can now be used in
-
1.0.0-alpha.2109 Jun 2025 pre-releaseRelease notes
Open source →Changed
- Improve automatic trait bounds (https://github.com/GREsau/schemars/pull/422 / https://github.com/GREsau/schemars/issues/373)
- Type params that are only used in skipped fields or
PhantomDatano longer have an unnecessaryJsonSchemabound automatically added - Remove type params from default
schema_name()whether or not they implJsonSchema. Type params can still be included in the name by specifying them in a rename attribute.
- Type params that are only used in skipped fields or
- Recursive references to the root schema type now use
"$ref": "#"instead of duplicating the entire schema within$defs/definitions(https://github.com/GREsau/schemars/pull/418 / https://github.com/GREsau/schemars/issues/175) - Schemas for untagged enum variants no longer have the
"title"set to the variant name (added in alpha.19) by default, but this behaviour is still available by setting theuntagged_enum_variant_titlesflag onSchemaSettings. (https://github.com/GREsau/schemars/pull/421 / https://github.com/GREsau/schemars/issues/420)
- Improve automatic trait bounds (https://github.com/GREsau/schemars/pull/422 / https://github.com/GREsau/schemars/issues/373)
-
1.0.0-alpha.2001 Jun 2025 pre-releaseRelease notes
Open source →Added
- Add
get_mut,pointer,pointer_mutmethods for easier manipulation ofSchemas (#416) - Use
patternPropertieson map schemas where appropriate (#417)- ⚠️
BTreeMap<K,V>/HashMap<K,V>now only implementJsonSchemawhen bothKandVimplementJsonSchema
- ⚠️
Fixed
- When a struct is
transparent, don't ignore other attributes (#415)
- Add
-
1.0.0-alpha.1931 May 2025 pre-releaseRelease notes
Open source →Added
- Support
#[serde(untagged)]on individual variants of enums (https://github.com/GREsau/schemars/issues/388 / https://github.com/GREsau/schemars/pull/412) - Set
"title"to variant name in schemas for untagged enums/variants (https://github.com/GREsau/schemars/issues/102 / https://github.com/GREsau/schemars/pull/413)
Changed
- When populating a schema's
"description"from rust doc comments, trim a single leading space from the comment (https://github.com/GREsau/schemars/pull/407) - Invalid
with/serialize_withattributes will now fail compilation rather than being silently ignored (https://github.com/GREsau/schemars/pull/410)
Removed
- Remove the
include_type_namesetting for including"x-rust-type"property on generated schemas, since it didn't solve the original feature request. If you have a use-case for that behaviour, please raise an issue in GitHub.
- Support
-
1.0.0-alpha.1826 May 2025 pre-releaseRelease notes
Open source →Added
#[schemars(inline)]attribute for inling schemas when derivingJsonSchema(https://github.com/GREsau/schemars/pull/380)- Implement
JsonSchemafor jiff 0.2 types, under the optionaljiff02feature flag (https://github.com/GREsau/schemars/pull/364) - Add methods to
dyn GenTransform, allowing to to be used similarly to adyn Any:fn is<T>(&self) -> boolfn downcast_ref<T>(&self) -> Option<&T>fn downcast_mut<T>(&mut self) -> Option<&mut T>fn downcast<T>(self: Box<Self>) -> Result<Box<T>, Box<Self>>
- Schemas for
i8/i16/u8/u16now includeminimumandmaximumproperties (https://github.com/GREsau/schemars/issues/298) schemars::transform::RestrictFormats- aTransformthat removes anyformatvalues that are not defined by the JSON Schema standard (or explicitly allowed by a custom list). This can be used to remove non-standardformats from schemas.SchemaSettingsnow has aninclude_type_nameflag. When enabled, this includes an"x-rust-type"property on generated schemas, set to the name of the schema's associated rust type.
Changed
- Rename
JsonSchema::always_inline_schema()toinline_schema(), because future attributes may allow particular fields to be uninlined - MSRV is now 1.74
GenTransform::as_anyandGenTransform::as_anyare deprecated and will be removed before schemars 1.0 becomes stable.- The generation of nullable schemas (i.e. schemas for
Option<T>) has been reworked, making them more accurate. TheSchemaSettings::option_nullableandSchemaSettings::option_add_null_typefields are no longer used - instead, generated schemas always include the"null"type, but this can be changed tonullableby using the newAddNullabletransform. - Update OpenAPI 3.0 meta-schema to an active URL (https://github.com/GREsau/schemars/issues/394)
- Change
SchemaSettings::meta_schemaandSchemaSettings::definitions_pathfromStringtoCow<'static, str>, making it easier to construct aSchemaSettingsin aconstcontext. - The
SchemaGenerator::take_definitionsmethod now takes anapply_transformsflag, which when enabled, will apply the generator's current transforms to each of the schema values in the returned map.
Release notes
Open source →f9bcfd8
Added
-
#[schemars(inline)] attribute for inling schemas when deriving JsonSchema ( #380 )
-
Implement JsonSchema for jiff 0.2 types, under the optional jiff02 feature flag ( #364 )
-
Add methods to dyn GenTransform , allowing to to be used similarly to a dyn Any :
-
fn is<T>(&self) -> bool
-
fn downcast_ref<T>(&self) -> Option<&T>
-
fn downcast_mut<T>(&mut self) -> Option<&mut T>
-
fn downcast<T>(self: Box<Self>) -> Result<Box<T>, Box<Self>>
-
Schemas for i8 / i16 / u8 / u16 now include minimum and maximum properties ( #298 )
-
schemars::transform::RestrictFormats - a Transform that removes any format values that are not defined by the JSON Schema standard (or explicitly allowed by a custom list). This can be used to remove non-standard format s from schemas.
-
SchemaSettings now has an include_type_name flag. When enabled, this includes an "x-rust-type" property on generated schemas, set to the name of the schema's associated rust type.
Changed
-
Rename JsonSchema::always_inline_schema() to inline_schema() , because future attributes may allow particular fields to be uninlined
-
MSRV is now 1.74
-
GenTransform::as_any and GenTransform::as_any are deprecated and will be removed before schemars 1.0 becomes stable.
-
The generation of nullable schemas (i.e. schemas for Option<T> ) has been reworked, making them more accurate. The SchemaSettings::option_nullable and SchemaSettings::option_add_null_type fields are no longer used - instead, generated schemas always include the "null" type, but this can be changed to nullable by using the new AddNullable transform.
-
Update OpenAPI 3.0 meta-schema to an active URL ( #394 )
-
Change SchemaSettings::meta_schema and SchemaSettings::definitions_path from String to Cow<'static, str> , making it easier to construct a SchemaSettings in a const context.
-
The SchemaGenerator::take_definitions method now takes an apply_transforms flag, which when enabled, will apply the generator's current transforms to each of the schema values in the returned map.
-
1.0.0-alpha.1702 Dec 2024 pre-releaseRelease notes
Open source →Changed
- For newtype variants of internally-tagged enums, prefer referencing the inner type's schema via
$refinstead of always inlining the schema (https://github.com/GREsau/schemars/pull/355) (this change was included in the release notes for 1.0.0-alpha.16, but was accidentally excluded from the published crate)
- For newtype variants of internally-tagged enums, prefer referencing the inner type's schema via
-
1.0.0-alpha.1625 Nov 2024 pre-releaseRelease notes
Open source →Removed (⚠️ breaking changes ⚠️)
- the
enumset1/enumsetoptional dependency has been removed, as itsJsonSchemaimpl did not actually match the default serialization format ofEnumSet(https://github.com/GREsau/schemars/pull/339)
Changed (⚠️ breaking changes ⚠️)
- MSRV is now 1.70
- The
exampleattribute 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).
Fixed
- The "deserialize" schema for
bytes::Bytes/BytesMutnow allows strings, matching the actual deserialize behaviour of the types. - The schema for
either::Eithernow matches the actual serialize/deserialize behaviour of that type.
- the
-
1.0.0-alpha.1505 Sep 2024 pre-releaseRelease notes
Open source →Added
SchemaSettingsnow has acontractfield 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 toSerializeto instead generate schemas describing the type's serialization behaviour (https://github.com/GREsau/schemars/issues/48 / https://github.com/GREsau/schemars/pull/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'senumarray "SHOULD have at least one element".
-
1.0.0-alpha.1429 Aug 2024 pre-releaseRelease notes
Open source →Added
- Read
#[garde(...)]attributes as an alternative to#[validate(...)](https://github.com/GREsau/schemars/issues/233 / https://github.com/GREsau/schemars/pull/331). See the documentation for a full list of supported attributes.
- Read
-
1.0.0-alpha.1327 Aug 2024 pre-releaseRelease notes
Open source →Fixed
- Fix compile errors when using
#[validate(regex(path = *expr))]attribute
- Fix compile errors when using
-
1.0.0-alpha.1227 Aug 2024 pre-releaseRelease notes
Open source →Fixed
- Allow
regex(path = ...)value to be a non-string expression (https://github.com/GREsau/schemars/issues/302 / https://github.com/GREsau/schemars/pull/328) - Respect
#[serde(rename_all_fields = ...)]attribute (https://github.com/GREsau/schemars/issues/273 / https://github.com/GREsau/schemars/pull/304)
Changed (⚠️ possibly-breaking changes ⚠️)
- Invalid attributes that were previously silently ignored (e.g. setting
schema_withon structs) will now cause compile errors - Validation attribute parsing has been altered to match the latest version of the validator crate:
- Remove the
phoneattribute - Remove the
required_nestedattribute regexandcontainsattributes must now be specified in list form#[validate(regex(path = ...))]rather than name/value form#[validate(regex = ...)]
- Remove the
- Allow
-
1.0.0-alpha.1124 Aug 2024 pre-releaseRelease notes
Open source →Changed
- Values in
#[doc = ...]and#[schemars(description = ..., title = ...)]attributes may now be any arbitrary expression rather than just string literals. (https://github.com/GREsau/schemars/issues/204 / https://github.com/GREsau/schemars/pull/327) - ⚠️ MSRV is now 1.65 ⚠️
- Values in
-
1.0.0-alpha.1022 Aug 2024 pre-releaseRelease notes
Open source →Fixed
- Fix some cases of unsatisfiable schemas generated when flattening enums (https://github.com/GREsau/schemars/pull/325 / https://github.com/GREsau/schemars/issues/164 / https://github.com/GREsau/schemars/issues/165)
-
1.0.0-alpha.921 Aug 2024 pre-releaseRelease notes
Open source →Added
- Add rustdoc for
derive(JsonSchema)macro (https://github.com/GREsau/schemars/issues/322 / https://github.com/GREsau/schemars/issues/322)
- Add rustdoc for
-
1.0.0-alpha.821 Aug 2024 pre-releaseRelease notes
Open source →Changed
- Replace
schemars::genmodule withschemars::generate. This is becausegenis a reserved keyword in rust 2024, so can only be used asr#gen. Theschemars::genmodule is still available for ease of upgrading, but is marked as deprecated and may be removed in the future 1.0.0 release. (https://github.com/GREsau/schemars/issues/306 / https://github.com/GREsau/schemars/pull/323)
- Replace
-
1.0.0-alpha.719 Aug 2024 pre-releaseRelease notes
Open source →Fixed
- Fix behaviour of
flattenfor schemas withadditionalProperties - Fix behaviour of
flattenof multiple enums (https://github.com/GREsau/schemars/issues/165 / https://github.com/GREsau/schemars/pull/320)
- Fix behaviour of
-
1.0.0-alpha.617 Aug 2024 pre-releaseRelease notes
Open source →Fixed
- Fixed a configuration error that caused rustdoc generation to fail on docs.rs
-
1.0.0-alpha.517 Aug 2024 pre-releaseRelease notes
Open source →Added
- Schemars can now be used in
no_stdenvironments by disabling the newstdfeature flag (which is enabled by default). Schemars still requires an allocator to be available.
- Schemars can now be used in
-
1.0.0-alpha.417 Aug 2024 pre-releaseRelease notes
Open source →Fixed
- Reduce size of MIR output (and improve release-mode compile time) when deriving
JsonSchemainvolving applying schema metadata - Fix
flattening ofserde_json::Value - Use absolute import for
Resultin derive output, ignoring any locally imported types calledResult(https://github.com/GREsau/schemars/pull/307)
- Reduce size of MIR output (and improve release-mode compile time) when deriving
-
1.0.0-alpha.310 Aug 2024 pre-releaseRelease notes
Open source →Added
#[schemars(transform = some::transform)]for applying arbitrary modifications to generated schemas.some::transformmust be an expression of typeschemars::transform::Transform- note that this can be a function with the signaturefn(&mut Schema) -> ().SchemaSettingsandSchemaGeneratorare both nowSend
Changed (⚠️ breaking changes ⚠️)
visitmodule andVisitortrait have been replace withtransformandTransformrespectively. Accordingly, these items have been renamed:SchemaSettings::visitors->SchemaSettings::transformsSchemaSettings::with_visitor->SchemaSettings::with_transformSchemaGenerator::visitors_mut->SchemaGenerator::transforms_mutGenVisitor->GenTransformVisitor::visit_schema->Transform::transformvisit::visit_schema->transform::transform_subschemas
GenTransformmust also implSend, but no longer needs to implDebug- Doc comments no longer have newlines collapsed when generating the
descriptionproperty (https://github.com/GREsau/schemars/pull/310)
-
1.0.0-alpha.205 Jun 2024 pre-releaseRelease notes
Open source →Added
#[schemars(extend("key" = value))]attribute which can be used to add properties (or replace existing properties) in a generated schema (https://github.com/GREsau/schemars/issues/50 / https://github.com/GREsau/schemars/pull/297)- Can be set on a struct, enum, or enum variant
- Value can be any expression that results in a value implementing
Serialize - Value can also be a JSON literal following the rules of
serde_json::json!(value)macro, i.e. it can interpolate other values that implementSerialize
-
1.0.0-alpha.127 May 2024 pre-releaseRelease notes
Open source →Added
json_schema!macro for creating a customSchema- Implement
JsonSchemafor uuid 1.x types, under the optionaluuid1feature flag SchemaSettings::draft2020_12()to construct settings conforming to JSON Schema draft 2020-12
Changed (⚠️ breaking changes ⚠️)
- The
Schematype is now defined as a thin wrapper around aserde_json::Value - The default
SchemaSettings(used by theschema_for!()/schema_for_value!()macros andSchemaGenerator::default()) now conform to JSON Schema draft 2020-12 instead of draft 7. - Schemas generated using
SchemaSettings::draft2019_09()(anddraft2020_12()anddefault()) now use$defsinstead ofdefinitions. While usingdefinitionsis allowed by the spec,$defsis the preferred property for storing reusable schemas. JsonSchema::schema_name()now returnsCow<'static, str>instead ofStringJsonSchema::is_referenceable()has been removed, and replaced with the more clearly-namedJsonSchema::always_inline_schema()(which should returns the opposite value to whatis_referenceablereturned!)- The
SchemaGenerator.definitionsfield is now aserde_json::Map<String, Value> - Macros/functions that previously returned a
RootSchemanow return aSchemainstead - All optional dependencies are now suffixed by their version:
chronois nowchrono04eitheris noweither1smallvecis nowsmallvec1urlis nowurl2bytesis nowbytes1rust_decimalis nowrust_decimal1enumsetis nowenumset1smol_stris nowsmol_str02semveris nowsemver1indexmap2,arrayvec07andbigdecimal04are unchanged
Removed (⚠️ breaking changes ⚠️)
- Removed deprecated
SchemaGeneratormethodsmake_extensible,schema_for_anyandschema_for_none - Removed the
schemamodule- The
Schematype is now accessible from the crate root (i.e.schemars::Schemainstead ofschemars::schema::Schema) - All other types that were in the module have been removed:
RootSchemaSchemaObjectMetadataSubschemaValidationNumberValidationStringValidationArrayValidationObjectValidationInstanceTypeSingleOrVec
- The
- Removed
schemars::Setandschemars::Maptype aliases - Removed the
impl_json_schemafeature flag -JsonSchemais now always implemented onSchema - Remove methods
visit_schema_objectandvisit_root_schemafrom theVisitortrait (visit_schemais unchanged)- Visitors that previously defined
visit_schema_objectshould instead definevisit_schemaand use anif let Some(obj) = schema.as_object_mut()or similar construct
- Visitors that previously defined
- Old versions of optional dependencies have been removed - all of these have newer versions (shown in brackets) which are supported by schemars
indexmap(consider usingindexmap2)uuid08(consider usinguuid1)arrayvec05(consider usingarrayvec07)bigdecimal03(consider usingbigdecimal04)
- Remove the retain_examples field from SetSingleExample, which is now a unit struct
-
0.9.026 May 2025Release notes
Open source →This version is identical to
1.0.0-alpha.18, but is available for those who are unable to unwilling to use a pre-release version.Those upgrading from Schemars 0.8 may want to consult the migration guide, which also applies when migrating from 0.8 to 0.9.
-
0.8.2225 Feb 2025Release notes
Open source →Fixed:
- Fix compatibility with rust 2024 edition (https://github.com/GREsau/schemars/pull/378)
-
0.8.2123 May 2024Release notes
Open source →Fixed:
- Fix
nulldefault not being set on generated schemas (https://github.com/GREsau/schemars/issues/295 / https://github.com/GREsau/schemars/pull/296)
- Fix
-
0.8.2018 May 2024Release notes
Open source →Fixed:
- Revert unintentional change in behaviour when combining
defaultandrequiredattributes (https://github.com/GREsau/schemars/issues/292)
- Revert unintentional change in behaviour when combining
-
0.8.1906 May 2024Release notes
Open source →Fixed:
- Regression that caused a compile error when deriving
JsonSchemaon an enum with no variants (https://github.com/GREsau/schemars/issues/287)
- Regression that caused a compile error when deriving
-
0.8.1806 May 2024Release notes
Open source →Fixed:
- Reduce size of MIR output (and improve release-mode compile time) when deriving
JsonSchemaon enums (https://github.com/GREsau/schemars/pull/266 / https://github.com/GREsau/schemars/pull/286)
- Reduce size of MIR output (and improve release-mode compile time) when deriving
-
0.8.1728 Apr 2024Release notes
Open source →Changed:
- Update to syn 2.0, which should improve compile times in many cases (https://github.com/GREsau/schemars/pull/281)
-
0.8.1611 Nov 2023Release notes
Open source →Fixed:
- Reduce size of MIR output (and improve release-mode compile time) when deriving
JsonSchema
- Reduce size of MIR output (and improve release-mode compile time) when deriving
-
0.8.1517 Sep 2023Release notes
Open source →Added:
- Implement
JsonSchemaforBigDecimalfrombigdecimal0.4 (https://github.com/GREsau/schemars/pull/237)
- Implement
-
0.8.1417 Sep 2023Release notes
Open source →Added:
- Add
#[schemars(inner(...)]attribute to specify schema for array items (https://github.com/GREsau/schemars/pull/234)
Changed:
- New optional associated function on
JsonSchematrait:schema_id(), which is similar toschema_name(), but does not have to be human-readable, and defaults to the type name including module path. This allows schemars to differentiate between types with the same name in different modules/crates (https://github.com/GREsau/schemars/issues/62 / https://github.com/GREsau/schemars/pull/247)
Fixed:
- Schemas for
rust_decimal::Decimalandbigdecimal::BigDecimalnow match how those types are serialized by default, i.e. as numeric strings (https://github.com/GREsau/schemars/pull/248)
- Add
-
0.8.1328 Aug 2023Release notes
Open source →Added:
- Implement
JsonSchemaforsemver::Version(https://github.com/GREsau/schemars/pull/195 / https://github.com/GREsau/schemars/pull/238) - Include const generics in generated schema names (https://github.com/GREsau/schemars/pull/179 / https://github.com/GREsau/schemars/pull/239)
- Implement
JsonSchemafor types from indexmap v2 (https://github.com/GREsau/schemars/pull/226 / https://github.com/GREsau/schemars/pull/240) - Implement
JsonSchemaforserde_json::value::RawValue(https://github.com/GREsau/schemars/pull/183)
Changed:
- Minimum supported rust version is now 1.60.0
- Implement
-
0.8.1226 Feb 2023Release notes
Open source →Added:
- Implement
JsonSchemaforsmol_str::SmolStr(https://github.com/GREsau/schemars/pull/72)
Changed:
- Change
serde_jsondependency min version to 1.0.25 (was 1.0.0) (https://github.com/GREsau/schemars/pull/192)
- Implement
-
0.8.1102 Oct 2022Release notes
Open source →Added:
- Replace auto-inferred trait bounds with bounds specified in
#[schemars(bound = "...")]attribute
Changed:
- Derived
JsonSchemanow respects attributes on unit enum variants (https://github.com/GREsau/schemars/pull/152) - Minimum supported rust version is now 1.45.0
- Replace auto-inferred trait bounds with bounds specified in
-
0.8.1017 May 2022Release notes
Open source →- Undo "Support generic default values in default attributes (https://github.com/GREsau/schemars/pull/83)" as it inadvertently introduced a breaking change (https://github.com/GREsau/schemars/issues/144)
-
0.8.916 May 2022Release notes
Open source →Added:
Support generic default values indefaultattributes (https://github.com/GREsau/schemars/pull/83)- This inadvertently introduced a breaking change and was removed in 0.8.10
- Add missing MIT licence text for usage of code from regex_syntax crate (https://github.com/GREsau/schemars/pull/132)
- Support uuid v1 and arrayvec 0.7 via feature flags
uuid1andarrayvec07(https://github.com/GREsau/schemars/pull/142)- This also adds
uuid08andarrayvec05feature flags for the previously supported versions of these crates. The existinguuidandarrayvecflags are still supported for backward-compatibility, but they are deprecated. - Similarly,
indexmap1feature flag is added, andindexmapflag is deprecated.
- This also adds
-
0.8.825 Nov 2021Release notes
Open source →Added:
- Implement
JsonSchemafor types fromrust_decimalandbigdecimalcrates (https://github.com/GREsau/schemars/pull/101)
Fixed:
- Fixes for internally tagged enums and flattening additional_properties (https://github.com/GREsau/schemars/pull/113)
- Implement
-
0.8.714 Nov 2021Release notes
Open source →Added:
- Implement
JsonSchemaforEnumSet(https://github.com/GREsau/schemars/pull/92)
Fixed:
- Do not cause compile error when using a default value that doesn't implement
Serialize(https://github.com/GREsau/schemars/issues/115)
- Implement
-
0.8.626 Sep 2021Release notes
Open source →Changed:
- Use
oneOfinstead ofanyOffor enums when possible (https://github.com/GREsau/schemars/issues/108)
- Use
-
0.8.520 Sep 2021Release notes
Open source →Fixed:
- Allow fields with plain
#[validate]attributes (https://github.com/GREsau/schemars/issues/109)
- Allow fields with plain
-
0.8.419 Sep 2021Release notes
Open source →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 (https://github.com/GREsau/schemars/pull/78)
-
0.8.305 Apr 2021Release notes
Open source →Added:
- Support for
#[schemars(crate = "...")]attribute to allow deriving JsonSchema when the schemars crate is aliased to a different name (https://github.com/GREsau/schemars/pull/55 / https://github.com/GREsau/schemars/pull/80) - Implement
JsonSchemaforbytes::Bytesandbytes::BytesMut(https://github.com/GREsau/schemars/pull/68)
Fixed:
- Fix deriving JsonSchema on types defined inside macros (https://github.com/GREsau/schemars/issues/59 / https://github.com/GREsau/schemars/issues/66 / https://github.com/GREsau/schemars/pull/79)
- Support for
-
0.8.227 Mar 2021Release notes
Open source →Added:
- Enable generating a schema from any serializable value using
schema_for_value!(...)macro orSchemaGenerator::root_schema_for_value()/SchemaGenerator::into_root_schema_for_value()methods (https://github.com/GREsau/schemars/pull/75) #[derive(JsonSchema_repr)]can be used on C-like enums for generating a serde_repr-compatible schema (https://github.com/GREsau/schemars/pull/76)- Implement
JsonSchemaforurl::Url(https://github.com/GREsau/schemars/pull/63)
- Enable generating a schema from any serializable value using
-
0.8.123 Mar 2021Release notes
Open source →Added:
SchemaGenerator::definitions_mut()which returns a mutable reference to the generator's schema definitions- Implement
JsonSchemafor slices
Changed:
- Minimum supported rust version is now 1.37.0
- Deriving JsonSchema on enums now sets
additionalPropertiesto 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 thedeny_unknown_fieldsattribute. - Schemas for HashSet and BTreeSet now have
uniqueItemsset to true (https://github.com/GREsau/schemars/pull/64)
Fixed
- Fix use of
#[serde(transparent)]in combination with#[schemars(with = ...)](https://github.com/GREsau/schemars/pull/67) - Fix clippy
field_reassign_with_defaultwarning in schemars_derive generated code in rust <1.51 (https://github.com/GREsau/schemars/pull/65) - Prevent stack overflow when using
inline_subschemaswith recursive types
-
0.8.027 Sep 2020Release notes
Open source →Added:
visit::Visitor, a trait for updating a schema and all schemas it contains recursively. ASchemaSettingscan now contain a list of visitors.into_object()method added toSchemaas a shortcut forinto::<SchemaObject>()- Preserve order of schema properties under
preserve_orderfeature flag (https://github.com/GREsau/schemars/issues/32) SchemaGenerator::take_definitions()which behaves similarly to the now-removedinto_definitions()method but without consuming the generatorSchemaGenerator::visitors_mut()which returns an iterator over a generator's settings's visitorsSchemaSettings::inline_subschemas- enforces inlining of all subschemas instead of using references (https://github.com/GREsau/schemars/issues/44)
Removed (BREAKING CHANGES):
SchemaSettings::bool_schemas- this has been superseded by theReplaceBoolSchemasvisitorSchemaSettings::allow_ref_siblings- this has been superseded by theRemoveRefSiblingsvisitorSchemaSettingsno longer implementsPartialEqSchemaGenerator::into_definitions()- this has been superseded bySchemaGenerator::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 (https://github.com/GREsau/schemars/issues/18)
Deprecated:
make_extensible,schema_for_any, andschema_for_nonemethods onSchemaGenerator
-
0.8.0-alpha-412 Jun 2020 pre-releaseNothing published for this version
-
0.8.0-alpha-312 Jun 2020 pre-releaseNothing published for this version