diff --git a/schemars/src/json_schema_impls/bytes.rs b/schemars/src/json_schema_impls/bytes.rs index 2a84cc2..f1a0f29 100644 --- a/schemars/src/json_schema_impls/bytes.rs +++ b/schemars/src/json_schema_impls/bytes.rs @@ -1,6 +1,7 @@ use crate::gen::SchemaGenerator; use crate::schema::*; use crate::JsonSchema; -use bytes::Bytes; +use bytes::{Bytes, BytesMut}; forward_impl!((JsonSchema for Bytes) => Vec); +forward_impl!((JsonSchema for BytesMut) => Vec); diff --git a/schemars/tests/bytes.rs b/schemars/tests/bytes.rs index 69b5612..688ab21 100644 --- a/schemars/tests/bytes.rs +++ b/schemars/tests/bytes.rs @@ -1,8 +1,8 @@ mod util; -use bytes::Bytes; +use bytes::{Bytes, BytesMut}; use util::*; #[test] fn bytes() -> TestResult { - test_default_generated_schema::("bytes") + test_default_generated_schema::<(Bytes, BytesMut)>("bytes") } diff --git a/schemars/tests/expected/bytes.json b/schemars/tests/expected/bytes.json index 294f0ec..5e1f9a5 100644 --- a/schemars/tests/expected/bytes.json +++ b/schemars/tests/expected/bytes.json @@ -1,10 +1,25 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Array_of_uint8", + "title": "Tuple_of_Array_of_uint8_and_Array_of_uint8", "type": "array", - "items": { - "type": "integer", - "format": "uint8", - "minimum": 0.0 - } -} + "items": [ + { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + }, + { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + ], + "maxItems": 2, + "minItems": 2 +} \ No newline at end of file