From 32b3f77bf7bdd5002117e7b9a62420934d746d69 Mon Sep 17 00:00:00 2001 From: Graham Esau Date: Tue, 23 Mar 2021 11:06:16 +0000 Subject: [PATCH] Implement `JsonSchema` for slices --- CHANGELOG.md | 1 + schemars/src/json_schema_impls/sequences.rs | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42cd847..643be93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## **In-dev** - [0.8.1] ### Added: - `SchemaGenerator::definitions_mut()` which returns a mutable reference to the generator's schema definitions +- Implement `JsonSchema` for slices ### Changed: - Minimum supported rust version is now 1.37.0 diff --git a/schemars/src/json_schema_impls/sequences.rs b/schemars/src/json_schema_impls/sequences.rs index 632a01e..58bb8e7 100644 --- a/schemars/src/json_schema_impls/sequences.rs +++ b/schemars/src/json_schema_impls/sequences.rs @@ -57,10 +57,11 @@ macro_rules! set_impl { }; } - seq_impl!( JsonSchema for std::collections::BinaryHeap); -set_impl!( JsonSchema for std::collections::BTreeSet); -set_impl!( JsonSchema for std::collections::HashSet); seq_impl!( JsonSchema for std::collections::LinkedList); +seq_impl!( JsonSchema for [T]); seq_impl!( JsonSchema for Vec); seq_impl!( JsonSchema for std::collections::VecDeque); + +set_impl!( JsonSchema for std::collections::BTreeSet); +set_impl!( JsonSchema for std::collections::HashSet);