Repository navigation
v1.0.0-alpha.18
Pre-release
Pre-release
Added
#[schemars(inline)]attribute for inling schemas when derivingJsonSchema(#380)- Implement
JsonSchemafor jiff 0.2 types, under the optionaljiff02feature flag (#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 (#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 (#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.