v1.0.0-alpha.1
Pre-release
Pre-release
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()(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