1.6 KiB
1.6 KiB
title | nav_order | permalink |
---|---|---|
Feature Flags | 5 | /features/ |
Feature Flags and Optional Dependencies
derive
(enabled by default) - provides#[derive(JsonSchema)]
macropreserve_order
- keep the order of struct fields inSchema
propertiesraw_value
- implementsJsonSchema
forserde_json::value::RawValue
(enables the serde_jsonraw_value
feature)
Schemars can implement JsonSchema
on types from several popular crates, enabled via feature flags (dependency versions are shown in brackets):
arrayvec07
- arrayvec (^0.7)bigdecimal04
- bigdecimal (^0.4)bytes1
- bytes (^1.0)chrono04
- chrono (^0.4)either1
- either (^1.3)enumset1
- enumset (^1.0)indexmap2
- indexmap (^2.0)rust_decimal1
- rust_decimal (^1.0)semver1
- semver (^1.0.9)smallvec1
- smallvec (^1.0)smol_str02
- smol_str (^0.2.1)url2
- url (^2.0)uuid1
- uuid (^1.0)
For example, to implement JsonSchema
on types from chrono
, enable it as a feature in the schemars
dependency in your Cargo.toml
like so:
[dependencies]
schemars = { version = "1.0.0-alpha.2", features = ["chrono04"] }