Skip to content

Commit

Permalink
Implement JsonSchema for Rocket types
Browse files Browse the repository at this point in the history
Implement  JsonSchema for:
- TempFile
- NamedFile
- RawStr
- RawStrBuf

Closes: #103
  • Loading branch information
ralpha committed Nov 8, 2024
1 parent a479e6c commit 4def481
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions schemars/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ smallvec1 = { version = "1.0", default-features = false, optional = true, packag
smol_str02 = { version = "0.2.1", default-features = false, optional = true, package = "smol_str" }
url2 = { version = "2.0", default-features = false, optional = true, package = "url" }
uuid1 = { version = "1.0", default-features = false, optional = true, package = "uuid" }
rocket05 = { version = "0.5", default-features = false, optional = true, package = "rocket" }

[dev-dependencies]
pretty_assertions = "1.2.1"
Expand Down
3 changes: 3 additions & 0 deletions schemars/src/json_schema_impls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,6 @@ mod url2;

#[cfg(feature = "uuid1")]
mod uuid1;

#[cfg(feature = "rocket05")]
mod rocket;
9 changes: 9 additions & 0 deletions schemars/src/json_schema_impls/rocket.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use crate::gen::SchemaGenerator;
use crate::schema::*;
use crate::JsonSchema;

forward_impl!(rocket::fs::TempFile<'_> => Vec<u8>);
forward_impl!(rocket::fs::NamedFile => Vec<u8>);

forward_impl!(rocket::http::RawStr => String);
forward_impl!(rocket::http::RawStrBuf => String);

0 comments on commit 4def481

Please sign in to comment.