Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions utoipa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ actix_extras = ["utoipa-gen?/actix_extras"]
rocket_extras = ["utoipa-gen?/rocket_extras"]
axum_extras = ["utoipa-gen?/axum_extras"]
chrono = ["utoipa-gen?/chrono"]
bytes = ["dep:bytes"]
decimal = ["utoipa-gen?/decimal"]
decimal_float = ["utoipa-gen?/decimal_float"]
non_strict_integers = ["utoipa-gen?/non_strict_integers"]
Expand Down Expand Up @@ -63,6 +64,7 @@ serde_json = { version = "1.0" }
serde_norway = {version = "0.9.42", optional = true}
utoipa-gen = { version = "5.4.0", path = "../utoipa-gen", optional = true }
indexmap = { version = "2", features = ["serde"] }
bytes = {version = "1", optional = true}

[dev-dependencies]
insta = { version = "1.41", features = ["json", "redactions"] }
Expand Down
10 changes: 10 additions & 0 deletions utoipa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,16 @@ impl PartialSchema for serde_json::Value {

impl ToSchema for serde_json::Value {}

#[cfg(feature = "bytes")]
const _: () = {
impl PartialSchema for bytes::Bytes {
fn schema() -> openapi::RefOr<openapi::schema::Schema> {
<Vec<u8> as PartialSchema>::schema()
}
}
impl ToSchema for bytes::Bytes {}
};
Comment on lines +803 to +810
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wrapping it to const _: () { } and not just block directly as { }?


// Create `utoipa` module so we can use `utoipa-gen` directly from `utoipa` crate.
// ONLY for internal use!
#[doc(hidden)]
Expand Down