External types
Schematic provides schema implementations for third-party crates through a concept known as external types. This functionality is opt-in through Cargo features.
Each feature implements the version of the crate that Schematic depends on, so the version in your
own Cargo.toml must be compatible with it, or the type won’t implement Schematic.
arrayvec
Requires the
type_arrayvecCargo feature, and arrayvec 0.7.
Implements schemas for ArrayVec and ArrayString from the
arrayvec crate. Each one’s capacity is its maximum length,
which for an ArrayString is in bytes, so a schema only rejects a string with more characters than
that.
chrono
Requires the
type_chronoCargo feature.
Implements schemas for Date, DateTime, Duration, Days, Months, IsoWeek, NaiveWeek,
NaiveDate, NaiveDateTime, and NaiveTime from the chrono
crate.
compact_str
Requires the
type_compact_strCargo feature, and compact_str 0.10.
Implements a schema for CompactString from the compact_str
crate.
hashbrown
Requires the
type_hashbrownCargo feature, and hashbrown 0.17.
Implements schemas for HashMap and HashSet from the
hashbrown crate.
indexmap
Requires the
type_indexmapCargo feature.
Implements a schema for IndexMap and IndexSet from the
indexmap crate.
jiff
Requires the
type_jiffCargo feature, and jiff 1.
Implements schemas for Timestamp, ZonedDateTime, Span, and SignedDuration, and the civil
Date, DateTime, Time, and ISOWeekDate, from the jiff crate.
Only Timestamp and Date have a format, date-time and date. The others are strings, as their
format would reject what jiff writes or reads: a ZonedDateTime ends with its time zone, like
[America/New_York], a civil DateTime and Time have no offset, an ISOWeekDate is a week, like
2024-W01-2, and a Span and SignedDuration are also read in jiff’s friendly format, like
1h 30m.
regex
Requires the
type_regexCargo feature.
Implements a schema for Regex from the regex crate.
To use
Regexas a setting, reach forRegexSetting, which supplies theDefaulta required setting needs.
relative-path
Requires the
type_relative_pathCargo feature.
Implements schemas for RelativePath and RelativePathBuf from the
relative-path crate.
rpkl
Requires the
pklCargo feature.
Implements a schema for Value from the rpkl crate.
rust_decimal
Requires the
type_rust_decimalCargo feature.
Implements a schema for Decimal from the rust_decimal
crate.
semver
Requires the
type_semverCargo feature.
Implements schemas for Version and VersionReq from the semver
crate.
To use
Versionas a setting, reach forVersionSetting, which supplies theDefaulta required setting needs.
ron
Requires the
ronCargo feature.
Implements a schema for Value from the ron crate.
serde_json
Requires the
jsonCargo feature.
Implements schemas for Value, Number, and Map from the
serde_json crate.
serde_yaml
Requires the
serde_yamlCargo feature onschematic_typesdirectly. Theschematiccrate does not enable it, as itsyamlfeature usesserde_norwayinstead.
Implements schemas for Value, Number, and Mapping from the
serde_yaml crate.
serde_yaml_norway
Requires the
yamlCargo feature.
Implements schemas for Value, Number, and Mapping from the
serde_norway crate.
smallvec
Requires the
type_smallvecCargo feature, and smallvec 1.
Implements a schema for SmallVec from the smallvec crate.
smol_str
Requires the
type_smol_strCargo feature, and smol_str 0.3.
Implements a schema for SmolStr from the smol_str crate.
toml
Requires the
tomlCargo feature.
Implements schemas for Value and Map from the toml crate.
url
Requires the
type_urlCargo feature.
Implements a schema for Url from the url crate.
uuid
Requires the
type_uuidCargo feature.
Implements a schema for Uuid from the uuid crate.