Skip to content

Commit

Permalink
feat: impl JsonTypdef for Url (behind a feature flag)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Karwowski committed Feb 1, 2024
1 parent ec59616 commit c042fba
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
67 changes: 67 additions & 0 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ documentation = "https://docs.rs/jtd-derive"
categories = ["encoding"]
keywords = ["schema", "codegen", "json"]

[features]
url = ["dep:url"]

[dependencies]
jtd-derive-macros = { version = "=0.1.3", path = "macros" }
serde = { version = "1.0.115", features = ["derive"] }
serde_json = "1.0.50"
thiserror = "1.0.3"
url = { version = "2", optional = true }

[dev-dependencies]
trybuild = "1.0.49"
6 changes: 6 additions & 0 deletions src/trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ impl_wrappers! {
std::net => SocketAddrV6 => String,

std::path => Path => String

}

#[cfg(feature = "url")]
impl_wrappers!{
url => Url => String
}

impl JsonTypedef for std::path::PathBuf {
Expand Down

0 comments on commit c042fba

Please sign in to comment.