Skip to content

Commit 5ab6c83

Browse files
authored
Add support for uuid 1.0 (#57)
1 parent 3543878 commit 5ab6c83

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ include = ["src/**/*", "LICENSE", "crates-io.md"]
2020
chrono = ["chrono04"]
2121
linked-hash-map = ["linked-hash-map05"]
2222
time = ["time03"]
23-
uuid = ["uuid08"]
23+
uuid = ["uuid08", "uuid1"]
2424

2525
[dependencies]
2626
indexmap = "1.7"
@@ -33,6 +33,7 @@ chrono04 = { package = "chrono", version = "0.4", default-features = false, opti
3333
linked-hash-map05 = { package = "linked-hash-map", version = "0.5", optional = true }
3434
time03 = { package = "time", version = "0.3", features = ["serde-human-readable"], optional = true }
3535
uuid08 = { package = "uuid", version = "0.8", optional = true }
36+
uuid1 = { package = "uuid", version = "1", optional = true }
3637

3738
[dev-dependencies]
3839
paste = "1.0"

src/impls.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ impl OpenapiType for uuid08::Uuid {
119119
}
120120
}
121121

122+
#[cfg(feature = "uuid1")]
123+
impl OpenapiType for uuid1::Uuid {
124+
fn visit_type<V: Visitor>(visitor: &mut V) {
125+
visitor.visit_uuid();
126+
}
127+
}
128+
122129
////////////////////////////////////////////////////////////////////////////////
123130

124131
#[cfg(any(feature = "time03", feature = "chrono04"))]

tests/std_types.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ test_type!(uuid08::Uuid = {
165165
"format": "uuid"
166166
});
167167

168+
#[cfg(feature = "uuid1")]
169+
test_type!(uuid1::Uuid = {
170+
"type": "string",
171+
"format": "uuid"
172+
});
173+
168174
// ### date/time
169175

170176
#[cfg(feature = "chrono04")]

0 commit comments

Comments
 (0)