Skip to content

Commit de969ed

Browse files
committed
Support uuid format
1 parent 933e9ee commit de969ed

15 files changed

Lines changed: 631 additions & 5 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"changes":{"Cargo.toml":"Patch"},"note":"Support uuid format","date":"2026-02-18T14:16:15.606465600Z"}

Cargo.lock

Lines changed: 171 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/vespera_macro/src/parser/schema/type_schema.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ fn parse_type_impl(
285285
format: Some("char".to_string()),
286286
..Schema::string()
287287
})),
288+
"Uuid" => SchemaRef::Inline(Box::new(Schema {
289+
format: Some("uuid".to_string()),
290+
..Schema::string()
291+
})),
288292
"String" | "str" => SchemaRef::Inline(Box::new(Schema::string())),
289293
// Date-time types from chrono and time crates
290294
"DateTime"

examples/axum-example/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ tokio = { version = "1", features = ["full"] }
1111
serde = { version = "1", features = ["derive"] }
1212
serde_json = "1"
1313
tower-http = { version = "0.6", features = ["cors"] }
14-
sea-orm = { version = "^2.0.0-rc.32", features = ["sqlx-sqlite", "runtime-tokio-rustls", "macros"] }
14+
sea-orm = { version = "^2.0.0-rc.32", features = ["sqlx-sqlite", "runtime-tokio-rustls", "macros", "with-uuid"] }
15+
uuid = { version = "1", features = ["v4", "serde"] }
1516
axum_typed_multipart = "0.16"
1617
tempfile = "3"
1718

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/dev-five-git/vespertide/refs/heads/main/schemas/model.schema.json",
3+
"name": "uuid_item",
4+
"description": "UUID item model for testing UUID format in OpenAPI",
5+
"columns": [
6+
{ "name": "id", "type": "uuid", "nullable": false, "primary_key": true, "default": "gen_random_uuid()", "comment": "Item ID" },
7+
{ "name": "name", "type": "text", "nullable": false, "comment": "Item name" },
8+
{ "name": "external_ref", "type": "uuid", "nullable": true, "comment": "External reference UUID" },
9+
{ "name": "created_at", "type": "timestamptz", "nullable": false, "default": "NOW()", "comment": "Created at" }
10+
]
11+
}

0 commit comments

Comments
 (0)