v0.8.0-alpha-3
This commit is contained in:
parent
260cd99293
commit
ca7c66eb08
4 changed files with 15 additions and 6 deletions
|
@ -5,11 +5,14 @@
|
|||
- `visit::Visitor`, a trait for updating a schema and all schemas it contains recursively. A `SchemaSettings` can now contain a list of visitors.
|
||||
- `into_object()` method added to `Schema` as a shortcut for `into::<SchemaObject>()`
|
||||
- Preserve order of schema properties under `preserve_order` feature flag (https://github.com/GREsau/schemars/issues/32)
|
||||
- `SchemaGenerator::take_definitions()` which behaves similarly to the now-removed `into_definitions()` method but without consuming the generator
|
||||
- `SchemaGenerator::visitors_mut()` which returns an iterator over a generator's settings's visitors
|
||||
|
||||
### Removed (**BREAKING CHANGES**):
|
||||
- `SchemaSettings::bool_schemas` - this has been superseded by the `ReplaceBoolSchemas` visitor
|
||||
- `SchemaSettings::allow_ref_siblings` - this has been superseded by the `RemoveRefSiblings` visitor
|
||||
- `SchemaSettings` no longer implements `PartialEq`
|
||||
- `SchemaGenerator::into_definitions()` - this has been superseded by `SchemaGenerator::take_definitions()`
|
||||
|
||||
### Fixed:
|
||||
- **BREAKING CHANGE** unknown items in `#[schemars(...)]` attributes now cause a compilation error (https://github.com/GREsau/schemars/issues/18)
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "schemars"
|
|||
description = "Generate JSON Schemas from Rust code"
|
||||
homepage = "https://graham.cool/schemars/"
|
||||
repository = "https://github.com/GREsau/schemars"
|
||||
version = "0.8.0-alpha-2"
|
||||
version = "0.8.0-alpha-3"
|
||||
authors = ["Graham Esau <gesau@hotmail.co.uk>"]
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
|
@ -13,7 +13,7 @@ categories = ["encoding"]
|
|||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
schemars_derive = { version = "=0.8.0-alpha-2", optional = true, path = "../schemars_derive" }
|
||||
schemars_derive = { version = "=0.8.0-alpha-3", optional = true, path = "../schemars_derive" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
dyn-clone = "1.0"
|
||||
|
|
|
@ -212,12 +212,18 @@ impl SchemaGenerator {
|
|||
&self.definitions
|
||||
}
|
||||
|
||||
/// Consumes `self` and returns the collection of all [referenceable](JsonSchema::is_referenceable) schemas that have been generated.
|
||||
/// Returns the collection of all [referenceable](JsonSchema::is_referenceable) schemas that have been generated,
|
||||
/// leaving an empty map in its place.
|
||||
///
|
||||
/// The keys of the returned `Map` are the [schema names](JsonSchema::schema_name), and the values are the schemas
|
||||
/// themselves.
|
||||
pub fn into_definitions(self) -> Map<String, Schema> {
|
||||
self.definitions
|
||||
pub fn take_definitions(&mut self) -> Map<String, Schema> {
|
||||
std::mem::replace(&mut self.definitions, Map::default())
|
||||
}
|
||||
|
||||
/// Returns an iterator over the [visitors](SchemaSettings::visitors) being used by this `SchemaGenerator`.
|
||||
pub fn visitors_mut(&mut self) -> impl Iterator<Item = &mut dyn Visitor2> {
|
||||
self.settings.visitors.iter_mut().map(|v| v.as_mut())
|
||||
}
|
||||
|
||||
/// Generates a root JSON Schema for the type `T`.
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "schemars_derive"
|
|||
description = "Macros for #[derive(JsonSchema)], for use with schemars"
|
||||
homepage = "https://graham.cool/schemars/"
|
||||
repository = "https://github.com/GREsau/schemars"
|
||||
version = "0.8.0-alpha-2"
|
||||
version = "0.8.0-alpha-3"
|
||||
authors = ["Graham Esau <gesau@hotmail.co.uk>"]
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue