Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for compact_str crate #308

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
17 changes: 16 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 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" }
compact_str = { version = "0.8.0", optional = true }

[dev-dependencies]
pretty_assertions = "1.2.1"
Expand Down Expand Up @@ -78,6 +79,7 @@ raw_value = ["serde_json/raw_value"]

# For internal/CI use only
_ui_test = []
compact_str = ["dep:compact_str"]

[[test]]
name = "ui"
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 @@ -83,6 +83,9 @@ forward_impl!((<A: smallvec1::Array> crate::JsonSchema for smallvec1::SmallVec<A
#[cfg(feature = "smol_str02")]
forward_impl!(smol_str02::SmolStr => alloc::string::String);

#[cfg(feature = "compact_str")]
forward_impl!(compact_str::CompactString => alloc::string::String);

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

Expand Down