Skip to content

Commit

Permalink
Add support for uuid 1.0 (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
msrd0 authored Mar 20, 2023
1 parent 3543878 commit 5ab6c83
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include = ["src/**/*", "LICENSE", "crates-io.md"]
chrono = ["chrono04"]
linked-hash-map = ["linked-hash-map05"]
time = ["time03"]
uuid = ["uuid08"]
uuid = ["uuid08", "uuid1"]

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

[dev-dependencies]
paste = "1.0"
Expand Down
7 changes: 7 additions & 0 deletions src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ impl OpenapiType for uuid08::Uuid {
}
}

#[cfg(feature = "uuid1")]
impl OpenapiType for uuid1::Uuid {
fn visit_type<V: Visitor>(visitor: &mut V) {
visitor.visit_uuid();
}
}

////////////////////////////////////////////////////////////////////////////////

#[cfg(any(feature = "time03", feature = "chrono04"))]
Expand Down
6 changes: 6 additions & 0 deletions tests/std_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ test_type!(uuid08::Uuid = {
"format": "uuid"
});

#[cfg(feature = "uuid1")]
test_type!(uuid1::Uuid = {
"type": "string",
"format": "uuid"
});

// ### date/time

#[cfg(feature = "chrono04")]
Expand Down

0 comments on commit 5ab6c83

Please sign in to comment.