Skip to content

Commit dc39eca

Browse files
committed
improve uuid validation and fix naming issues
1 parent 0204592 commit dc39eca

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/model/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
//! # Customer
1+
//! # Client
22
//!
3-
//! `model::customer` is a model for the Ruddr Client object. This module is not publically accessible, but the structs and members are public for reading from `interface::customer` returns.
3+
//! `model::client` is a model for the Ruddr Client object. This module is not publically accessible, but the structs and members are public for reading from `interface::client` returns.
44
//! [API Documentation](https://ruddr.readme.io/reference/client-object)
55
use crate::model::{shared, types};
66
use serde::Deserialize;

src/model/expense_item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! # Expense
1+
//! # Expense Item
22
//!
33
//! `model::expense_item` is a model for the Ruddr Expense Item object. This module is not publically accessible, but the structs and members are public for reading from `interface::expense_item` returns.
44
//! [API Documentation](https://ruddr.readme.io/reference/expense-item-object) (documentation has `Description` of `statusId` and `vendor` switched)

src/model/expense_report.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
//! # Expense
1+
//! # Expense Report
22
//!
3-
//! `model::expense` is models for the Ruddr Expense Report and Expense Item objects. This module is not publically accessible, but the structs and members are public for reading from `interface::expense` returns.
3+
//! `model::expense_report` is models for the Ruddr Expense Report and Expense Item objects. This module is not publically accessible, but the structs and members are public for reading from `interface::expense_report` returns.
44
//! [API Documentation](https://ruddr.readme.io/reference/expense-report-object)
55
use crate::model::{shared, types};
66
use serde::Deserialize;

src/model/types.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ pub struct UUID(pub(super) String);
154154
impl UUID {
155155
// constructor with validation used within type converters
156156
fn new(uuid: String) -> Result<Self, String> {
157-
let uuid_validator = Regex::new(r"^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$").unwrap();
157+
let uuid_validator = Regex::new(
158+
r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
159+
)
160+
.unwrap();
158161
if uuid_validator.is_match(&uuid) {
159162
Ok(UUID(uuid))
160163
} else {

0 commit comments

Comments
 (0)