Make schemars_derive optional
This commit is contained in:
parent
5a28cef598
commit
985280c388
4 changed files with 10 additions and 2 deletions
|
@ -203,6 +203,7 @@ fn main() {
|
||||||
`#[serde(...)]` attributes can be overriden using `#[schemars(...)]` attributes, which behave identically (e.g. `#[schemars(rename_all = "camelCase")]`). You may find this useful if you want to change the generated schema without affecting Serde's behaviour, or if you're just not using Serde.
|
`#[serde(...)]` attributes can be overriden using `#[schemars(...)]` attributes, which behave identically (e.g. `#[schemars(rename_all = "camelCase")]`). You may find this useful if you want to change the generated schema without affecting Serde's behaviour, or if you're just not using Serde.
|
||||||
|
|
||||||
## Feature Flags
|
## Feature Flags
|
||||||
|
- `derive` (enabled by default) - provides `#[derive(JsonSchema)]` macro
|
||||||
- `impl_json_schema` - implements `JsonSchema` for Schemars types themselves
|
- `impl_json_schema` - implements `JsonSchema` for Schemars types themselves
|
||||||
|
|
||||||
## Optional Dependencies
|
## Optional Dependencies
|
||||||
|
|
|
@ -14,6 +14,7 @@ schemars = { version = "0.6", features = ["chrono"] }
|
||||||
```
|
```
|
||||||
|
|
||||||
## Feature Flags
|
## Feature Flags
|
||||||
|
- `derive` (enabled by default) - provides `#[derive(JsonSchema)]` macro
|
||||||
- `impl_json_schema` - implements `JsonSchema` for Schemars types themselves
|
- `impl_json_schema` - implements `JsonSchema` for Schemars types themselves
|
||||||
|
|
||||||
## Optional Dependencies
|
## Optional Dependencies
|
||||||
|
|
|
@ -13,7 +13,7 @@ categories = ["encoding"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
schemars_derive = { version = "=0.7.4", path = "../schemars_derive" }
|
schemars_derive = { version = "=0.7.4", optional = true, path = "../schemars_derive" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
|
||||||
|
@ -28,7 +28,11 @@ arrayvec = { version = "0.5", default-features = false, optional = true }
|
||||||
pretty_assertions = "0.6.1"
|
pretty_assertions = "0.6.1"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
impl_json_schema = []
|
default = ["derive"]
|
||||||
|
|
||||||
|
derive = ["schemars_derive"]
|
||||||
|
|
||||||
|
impl_json_schema = ["derive"]
|
||||||
# derive_json_schema will be removed in a later version
|
# derive_json_schema will be removed in a later version
|
||||||
derive_json_schema = ["impl_json_schema"]
|
derive_json_schema = ["impl_json_schema"]
|
||||||
|
|
||||||
|
|
|
@ -197,6 +197,7 @@ fn main() {
|
||||||
`#[serde(...)]` attributes can be overriden using `#[schemars(...)]` attributes, which behave identically (e.g. `#[schemars(rename_all = "camelCase")]`). You may find this useful if you want to change the generated schema without affecting Serde's behaviour, or if you're just not using Serde.
|
`#[serde(...)]` attributes can be overriden using `#[schemars(...)]` attributes, which behave identically (e.g. `#[schemars(rename_all = "camelCase")]`). You may find this useful if you want to change the generated schema without affecting Serde's behaviour, or if you're just not using Serde.
|
||||||
|
|
||||||
## Feature Flags
|
## Feature Flags
|
||||||
|
- `derive` (enabled by default) - provides `#[derive(JsonSchema)]` macro
|
||||||
- `impl_json_schema` - implements `JsonSchema` for Schemars types themselves
|
- `impl_json_schema` - implements `JsonSchema` for Schemars types themselves
|
||||||
|
|
||||||
## Optional Dependencies
|
## Optional Dependencies
|
||||||
|
@ -230,6 +231,7 @@ pub mod gen;
|
||||||
/// JSON Schema types.
|
/// JSON Schema types.
|
||||||
pub mod schema;
|
pub mod schema;
|
||||||
|
|
||||||
|
#[cfg(feature = "schemars_derive")]
|
||||||
pub use schemars_derive::*;
|
pub use schemars_derive::*;
|
||||||
|
|
||||||
// Export serde_json so schemars_derive can use it
|
// Export serde_json so schemars_derive can use it
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue