From ce3f1ea9b7ebfd9a0d80f6a9bf3d2af205a0e6bc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Oct 2026 09:33:33 -0700 Subject: [PATCH 01/11] chore(deps): bump thiserror from 2.0.20 to 2.0.21 (#1087) Bumps [thiserror](https://github.com/dtolnay/thiserror) from 2.0.20 to 2.0.21. - [Release notes](https://github.com/dtolnay/thiserror/releases) - [Commits](https://github.com/dtolnay/thiserror/compare/2.0.20...2.0.21) --- updated-dependencies: - dependency-name: thiserror dependency-version: 2.0.21 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5400cb98..4def7fff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1089,11 +1089,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.20" +version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" dependencies = [ - "thiserror-impl 2.0.20", + "thiserror-impl 2.0.21", ] [[package]] @@ -1109,9 +1109,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.20" +version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" dependencies = [ "proc-macro2", "quote", @@ -1309,7 +1309,7 @@ dependencies = [ "serde", "serde_json", "syn 3.0.6", - "thiserror 2.0.20", + "thiserror 2.0.21", "unicode-ident", "uuid", ] From 48675a9462abf988bb01e8f799430451b967cd1a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Oct 2026 09:21:15 -0700 Subject: [PATCH 02/11] chore(deps): bump syn from 3.0.6 to 3.0.7 (#1092) Bumps [syn](https://github.com/dtolnay/syn) from 3.0.6 to 3.0.7. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/3.0.6...3.0.7) --- updated-dependencies: - dependency-name: syn dependency-version: 3.0.7 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4def7fff..338bff80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -239,7 +239,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 3.0.6", + "syn 3.0.7", ] [[package]] @@ -364,7 +364,7 @@ dependencies = [ "schemars", "serde", "serde_json", - "syn 3.0.6", + "syn 3.0.7", "typify", ] @@ -734,7 +734,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bfe0f4c752e450fc2faf62654f1c134747922825d5b04ca717b8874f41a40c0" dependencies = [ "proc-macro2", - "syn 3.0.6", + "syn 3.0.7", ] [[package]] @@ -862,7 +862,7 @@ dependencies = [ "proc-macro2", "quote", "schema-derive", - "syn 3.0.6", + "syn 3.0.7", ] [[package]] @@ -874,7 +874,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 3.0.6", + "syn 3.0.7", ] [[package]] @@ -935,7 +935,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn 3.0.6", + "syn 3.0.7", ] [[package]] @@ -989,7 +989,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 3.0.6", + "syn 3.0.7", ] [[package]] @@ -1035,9 +1035,9 @@ dependencies = [ [[package]] name = "syn" -version = "3.0.6" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee" +checksum = "d62a2e0561533f2ca2561d0cf27fd9fedb640a1bf2616ff5d5c80d99017faadc" dependencies = [ "proc-macro2", "quote", @@ -1115,7 +1115,7 @@ checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" dependencies = [ "proc-macro2", "quote", - "syn 3.0.6", + "syn 3.0.7", ] [[package]] @@ -1308,7 +1308,7 @@ dependencies = [ "semver", "serde", "serde_json", - "syn 3.0.6", + "syn 3.0.7", "thiserror 2.0.21", "unicode-ident", "uuid", @@ -1325,7 +1325,7 @@ dependencies = [ "serde", "serde_json", "serde_tokenstream", - "syn 3.0.6", + "syn 3.0.7", "typify-impl", ] @@ -1339,7 +1339,7 @@ dependencies = [ "schemars", "serde", "serde_json", - "syn 3.0.6", + "syn 3.0.7", "typify", ] From f8dd9160fec6620ef31debe690849432036f9e96 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Oct 2026 09:21:25 -0700 Subject: [PATCH 03/11] chore(deps): bump trybuild from 1.0.121 to 1.0.122 (#1091) Bumps [trybuild](https://github.com/dtolnay/trybuild) from 1.0.121 to 1.0.122. - [Release notes](https://github.com/dtolnay/trybuild/releases) - [Commits](https://github.com/dtolnay/trybuild/compare/1.0.121...1.0.122) --- updated-dependencies: - dependency-name: trybuild dependency-version: 1.0.122 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 338bff80..078a8529 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1257,9 +1257,9 @@ dependencies = [ [[package]] name = "trybuild" -version = "1.0.121" +version = "1.0.122" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0cabaa10be1917331a313866bd94526343e03c77bcf69144b62b072ad35d47c" +checksum = "62db9c92d704393fbf2132041720cc80b689f2d3f28521015c2ac866223c11b8" dependencies = [ "glob", "serde", From e8bba8b86b3e0b6063aa86853ecf76600774c95d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Oct 2026 10:10:29 -0700 Subject: [PATCH 04/11] chore(deps): bump syn from 3.0.7 to 3.0.9 (#1095) Bumps [syn](https://github.com/dtolnay/syn) from 3.0.7 to 3.0.9. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/3.0.7...3.0.9) --- updated-dependencies: - dependency-name: syn dependency-version: 3.0.9 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 078a8529..15299918 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -239,7 +239,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 3.0.7", + "syn 3.0.9", ] [[package]] @@ -364,7 +364,7 @@ dependencies = [ "schemars", "serde", "serde_json", - "syn 3.0.7", + "syn 3.0.9", "typify", ] @@ -734,7 +734,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bfe0f4c752e450fc2faf62654f1c134747922825d5b04ca717b8874f41a40c0" dependencies = [ "proc-macro2", - "syn 3.0.7", + "syn 3.0.9", ] [[package]] @@ -862,7 +862,7 @@ dependencies = [ "proc-macro2", "quote", "schema-derive", - "syn 3.0.7", + "syn 3.0.9", ] [[package]] @@ -874,7 +874,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 3.0.7", + "syn 3.0.9", ] [[package]] @@ -935,7 +935,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn 3.0.7", + "syn 3.0.9", ] [[package]] @@ -989,7 +989,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 3.0.7", + "syn 3.0.9", ] [[package]] @@ -1035,9 +1035,9 @@ dependencies = [ [[package]] name = "syn" -version = "3.0.7" +version = "3.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d62a2e0561533f2ca2561d0cf27fd9fedb640a1bf2616ff5d5c80d99017faadc" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" dependencies = [ "proc-macro2", "quote", @@ -1115,7 +1115,7 @@ checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" dependencies = [ "proc-macro2", "quote", - "syn 3.0.7", + "syn 3.0.9", ] [[package]] @@ -1308,7 +1308,7 @@ dependencies = [ "semver", "serde", "serde_json", - "syn 3.0.7", + "syn 3.0.9", "thiserror 2.0.21", "unicode-ident", "uuid", @@ -1325,7 +1325,7 @@ dependencies = [ "serde", "serde_json", "serde_tokenstream", - "syn 3.0.7", + "syn 3.0.9", "typify-impl", ] @@ -1339,7 +1339,7 @@ dependencies = [ "schemars", "serde", "serde_json", - "syn 3.0.7", + "syn 3.0.9", "typify", ] From dcbfbbbbaac6337f1b16256ee7ef7d32a14069dc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Oct 2026 10:11:10 -0700 Subject: [PATCH 05/11] chore(deps): bump serde_json from 1.0.151 to 1.0.154 (#1096) Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.151 to 1.0.154. - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.151...v1.0.154) --- updated-dependencies: - dependency-name: serde_json dependency-version: 1.0.154 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 15299918..9021ec4a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -951,9 +951,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.151" +version = "1.0.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" dependencies = [ "itoa", "memchr", From e934abcd55352e60ef8d98edd3ae3b2283d03246 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Oct 2026 10:12:35 -0700 Subject: [PATCH 06/11] chore(deps): bump unicode-ident from 1.0.26 to 1.0.27 (#1097) Bumps [unicode-ident](https://github.com/dtolnay/unicode-ident) from 1.0.26 to 1.0.27. - [Release notes](https://github.com/dtolnay/unicode-ident/releases) - [Commits](https://github.com/dtolnay/unicode-ident/compare/1.0.26...1.0.27) --- updated-dependencies: - dependency-name: unicode-ident dependency-version: 1.0.27 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9021ec4a..22113bdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1345,9 +1345,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" [[package]] name = "unicode-segmentation" From 01cc60d9d9f8fcdd0ade76d5f38b9aaa1377545c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Nov 2026 10:12:23 -0800 Subject: [PATCH 07/11] chore(deps): bump log from 0.4.34 to 0.4.35 (#1100) Bumps [log](https://github.com/rust-lang/log) from 0.4.34 to 0.4.35. - [Release notes](https://github.com/rust-lang/log/releases) - [Changelog](https://github.com/rust-lang/log/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-lang/log/compare/0.4.34...v0.4.35) --- updated-dependencies: - dependency-name: log dependency-version: 0.4.35 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 22113bdf..7e59ee69 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -599,9 +599,9 @@ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "log" -version = "0.4.34" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" [[package]] name = "memchr" From a4c4fa85c3a59ca167fa0f1c9f8a00499d0c31a4 Mon Sep 17 00:00:00 2001 From: Tom van der Woerdt Date: Fri, 13 Nov 2026 00:31:38 -0500 Subject: [PATCH 08/11] Enable unicode modifier in regex patterns (#1103) --- cargo-typify/README.md | 2 +- typify-impl/src/convert.rs | 22 ++++++++++-- typify-impl/src/type_entry.rs | 2 +- typify-impl/src/util.rs | 21 ++++++++++- typify-impl/tests/vega.out | 36 +++++++++++++------ typify/tests/schemas/id-or-name.rs | 4 +-- typify/tests/schemas/merged-schemas.rs | 2 +- typify/tests/schemas/property-pattern.rs | 4 ++- typify/tests/schemas/types-with-more-impls.rs | 2 +- .../schemas/various-enums-json-schema.rs | 4 +-- typify/tests/schemas/various-enums.rs | 4 +-- 11 files changed, 78 insertions(+), 25 deletions(-) diff --git a/cargo-typify/README.md b/cargo-typify/README.md index 4b6b3408..d63e5f9b 100644 --- a/cargo-typify/README.md +++ b/cargo-typify/README.md @@ -134,7 +134,7 @@ impl std::str::FromStr for Name { if value.len() > 63usize { return Err("longer than 63 characters"); } - if regress::Regex::new("^(?![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}$)^[a-z][a-z0-9-]*[a-zA-Z0-9]$") + if regress::Regex::with_flags("^(?![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}$)^[a-z][a-z0-9-]*[a-zA-Z0-9]$", "u") .unwrap() .find(value) .is_none() diff --git a/typify-impl/src/convert.rs b/typify-impl/src/convert.rs index 7c1716e7..bc7f6cae 100644 --- a/typify-impl/src/convert.rs +++ b/typify-impl/src/convert.rs @@ -875,11 +875,12 @@ impl TypeSpace { Some(validation) => { if let Some(pattern) = &validation.pattern { - let _ = - regress::Regex::new(pattern).map_err(|e| Error::InvalidSchema { + let _ = regress::Regex::with_flags(pattern, "u").map_err(|e| { + Error::InvalidSchema { type_name: type_name.clone().into_option(), reason: format!("invalid pattern '{}' {}", pattern, e), - })?; + } + })?; self.uses_regress = true; } @@ -2192,6 +2193,21 @@ mod tests { assert_eq!(type_space.iter_types().count(), 4); } + #[test] + fn test_unicode_pattern_rejects_identity_escape() { + let schema = serde_json::from_value(json!({ + "title": "InvalidUnicodePattern", + "type": "string", + "pattern": r"\a", + })) + .unwrap(); + + assert!(matches!( + TypeSpace::default().add_root_schema(schema), + Err(Error::InvalidSchema { .. }) + )); + } + #[test] fn test_basic_option_flat() { #[derive(JsonSchema, Schema)] diff --git a/typify-impl/src/type_entry.rs b/typify-impl/src/type_entry.rs index 2881f555..d90d0b07 100644 --- a/typify-impl/src/type_entry.rs +++ b/typify-impl/src/type_entry.rs @@ -1596,7 +1596,7 @@ impl TypeEntry { let err = format!("doesn't match pattern \"{}\"", p); quote! { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { - ::regress::Regex::new(#p).unwrap() + ::regress::Regex::with_flags(#p, "u").unwrap() }); if PATTERN.find(value).is_none() { return Err(#err.into()); diff --git a/typify-impl/src/util.rs b/typify-impl/src/util.rs index 9880b91b..0b8e065f 100644 --- a/typify-impl/src/util.rs +++ b/typify-impl/src/util.rs @@ -909,7 +909,7 @@ impl StringValidator { .pattern .as_ref() .map(|pattern| { - regress::Regex::new(pattern).map_err(|e| Error::InvalidSchema { + regress::Regex::with_flags(pattern, "u").map_err(|e| Error::InvalidSchema { type_name: type_name.clone().into_option(), reason: format!("invalid pattern '{}' {}", pattern, e), }) @@ -1195,6 +1195,25 @@ mod tests { assert!(!ach.is_valid("Abednego")); } + #[test] + fn test_string_validation_unicode_pattern() { + for (pattern, valid, invalid) in [ + (r"^\p{Letter}+$", "héllo", "123"), + (r"^\u{1F354}$", "🍔", "a"), + ] { + let validator = StringValidator::new( + &Name::Unknown, + Some(&StringValidation { + pattern: Some(pattern.to_string()), + ..Default::default() + }), + ) + .unwrap(); + assert!(validator.is_valid(valid), "{pattern} should match {valid}"); + assert!(!validator.is_valid(invalid)); + } + } + #[test] fn test_string_validation_multi_byte() { // minLength/maxLength count Unicode code points, not UTF-8 bytes. diff --git a/typify-impl/tests/vega.out b/typify-impl/tests/vega.out index 6c3dea2c..72d74e60 100644 --- a/typify-impl/tests/vega.out +++ b/typify-impl/tests/vega.out @@ -7165,7 +7165,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -7451,7 +7453,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -7779,7 +7783,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -8112,7 +8118,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -8635,7 +8643,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -8921,7 +8931,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -9249,7 +9261,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -9582,7 +9596,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -11176,7 +11192,7 @@ impl ::std::convert::TryFrom<&str> for EncodeKey { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^.+$").unwrap()); + ::std::sync::LazyLock::new(|| ::regress::Regex::with_flags("^.+$", "u").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^.+$\"".into()); } @@ -42548,7 +42564,7 @@ impl ::std::convert::TryFrom<&str> for TitleObjectEncodeSubtype0Key { fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { - ::regress::Regex::new("^(?!interactive|name|style).+$").unwrap() + ::regress::Regex::with_flags("^(?!interactive|name|style).+$", "u").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(?!interactive|name|style).+$\"".into()); diff --git a/typify/tests/schemas/id-or-name.rs b/typify/tests/schemas/id-or-name.rs index 1d3f2b13..0069c88c 100644 --- a/typify/tests/schemas/id-or-name.rs +++ b/typify/tests/schemas/id-or-name.rs @@ -177,7 +177,7 @@ impl ::std::convert::TryFrom<&str> for IdOrYoloYolo { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new(".*").unwrap()); + ::std::sync::LazyLock::new(|| ::regress::Regex::with_flags(".*", "u").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \".*\"".into()); } @@ -232,7 +232,7 @@ impl ::std::convert::TryFrom<&str> for Name { } static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new( || { - :: regress :: Regex :: new ("^(?![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}$)^[a-z][a-z0-9-]*[a-zA-Z0-9]$") . unwrap () + :: regress :: Regex :: with_flags ("^(?![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}$)^[a-z][a-z0-9-]*[a-zA-Z0-9]$" , "u") . unwrap () }, ); if PATTERN.find(value).is_none() { diff --git a/typify/tests/schemas/merged-schemas.rs b/typify/tests/schemas/merged-schemas.rs index 25b39cf2..ba12f242 100644 --- a/typify/tests/schemas/merged-schemas.rs +++ b/typify/tests/schemas/merged-schemas.rs @@ -393,7 +393,7 @@ impl ::std::convert::TryFrom<&str> for TriplePattern { fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { - ::regress::Regex::new("(?=^[a-z].+$)(?=^.{4,8}$)(?=.+[a-z]$)").unwrap() + ::regress::Regex::with_flags("(?=^[a-z].+$)(?=^.{4,8}$)(?=.+[a-z]$)", "u").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"(?=^[a-z].+$)(?=^.{4,8}$)(?=.+[a-z]$)\"".into()); diff --git a/typify/tests/schemas/property-pattern.rs b/typify/tests/schemas/property-pattern.rs index 54652f5e..6f07646a 100644 --- a/typify/tests/schemas/property-pattern.rs +++ b/typify/tests/schemas/property-pattern.rs @@ -36,7 +36,9 @@ impl ::std::convert::TryFrom<&str> for TestGrammarForPatternPropertiesRulesKey { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^[a-zA-Z_]\\w*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^[a-zA-Z_]\\w*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-zA-Z_]\\w*$\"".into()); } diff --git a/typify/tests/schemas/types-with-more-impls.rs b/typify/tests/schemas/types-with-more-impls.rs index c996bee4..69a81957 100644 --- a/typify/tests/schemas/types-with-more-impls.rs +++ b/typify/tests/schemas/types-with-more-impls.rs @@ -24,7 +24,7 @@ impl ::std::convert::TryFrom<&str> for PatternString { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("xx").unwrap()); + ::std::sync::LazyLock::new(|| ::regress::Regex::with_flags("xx", "u").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"xx\"".into()); } diff --git a/typify/tests/schemas/various-enums-json-schema.rs b/typify/tests/schemas/various-enums-json-schema.rs index 57540b41..862538ae 100644 --- a/typify/tests/schemas/various-enums-json-schema.rs +++ b/typify/tests/schemas/various-enums-json-schema.rs @@ -435,7 +435,7 @@ impl ::std::convert::TryFrom<&str> for Ipv4Net { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new(".*").unwrap()); + ::std::sync::LazyLock::new(|| ::regress::Regex::with_flags(".*", "u").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \".*\"".into()); } @@ -496,7 +496,7 @@ impl ::std::convert::TryFrom<&str> for Ipv6Net { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new(".*").unwrap()); + ::std::sync::LazyLock::new(|| ::regress::Regex::with_flags(".*", "u").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \".*\"".into()); } diff --git a/typify/tests/schemas/various-enums.rs b/typify/tests/schemas/various-enums.rs index 38a513f6..5e819ea7 100644 --- a/typify/tests/schemas/various-enums.rs +++ b/typify/tests/schemas/various-enums.rs @@ -386,7 +386,7 @@ impl ::std::convert::TryFrom<&str> for Ipv4Net { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new(".*").unwrap()); + ::std::sync::LazyLock::new(|| ::regress::Regex::with_flags(".*", "u").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \".*\"".into()); } @@ -437,7 +437,7 @@ impl ::std::convert::TryFrom<&str> for Ipv6Net { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new(".*").unwrap()); + ::std::sync::LazyLock::new(|| ::regress::Regex::with_flags(".*", "u").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \".*\"".into()); } From 59020638bf2dfad7f587480ce41664f300a766cd Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Sun, 15 Nov 2026 09:49:47 -0800 Subject: [PATCH 09/11] update typespace to 0.1.1 Brings the u flag to the generated pattern checks, matching the schema-time validation from #1104, and the fix for a pattern-constrained newtype over a string-like native type. The fixture changes are the flag alone. --- Cargo.lock | 4 +-- Cargo.toml | 2 +- typify-impl/tests/vega.out | 36 +++++++++++++------ typify/tests/schemas/id-or-name.rs | 4 +-- typify/tests/schemas/merged-schemas.rs | 2 +- typify/tests/schemas/property-pattern.rs | 4 ++- typify/tests/schemas/types-with-more-impls.rs | 2 +- .../schemas/various-enums-json-schema.rs | 4 +-- typify/tests/schemas/various-enums.rs | 4 +-- 9 files changed, 40 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3d8b021b..b3627c4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1313,9 +1313,9 @@ dependencies = [ [[package]] name = "typespace" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bfd314a399873b377783fb16852995be87d0d3bb574f9180bc1eb001604c089" +checksum = "4098cf680a26e9cd5186e4555de0b0afbe6a30e02ecbbc5f6fdf320d81aaec2a" dependencies = [ "codespace", "heck", diff --git a/Cargo.toml b/Cargo.toml index dfef315f..83eeb859 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,6 +43,6 @@ syn = { version = "3.0.2", features = ["full"] } tempfile = "3.27.0" thiserror = "2.0.18" trybuild = "1.0.116" -typespace = "0.1.0" +typespace = "0.1.1" unicode-ident = "1.0.24" uuid = "1.16.0" diff --git a/typify-impl/tests/vega.out b/typify-impl/tests/vega.out index 6c3dea2c..72d74e60 100644 --- a/typify-impl/tests/vega.out +++ b/typify-impl/tests/vega.out @@ -7165,7 +7165,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -7451,7 +7453,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -7779,7 +7783,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -8112,7 +8118,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -8635,7 +8643,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -8921,7 +8931,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -9249,7 +9261,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -9582,7 +9596,9 @@ impl ::std::convert::TryFrom<&str> type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^(date|utc):.*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^(date|utc):.*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(date|utc):.*$\"".into()); } @@ -11176,7 +11192,7 @@ impl ::std::convert::TryFrom<&str> for EncodeKey { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^.+$").unwrap()); + ::std::sync::LazyLock::new(|| ::regress::Regex::with_flags("^.+$", "u").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^.+$\"".into()); } @@ -42548,7 +42564,7 @@ impl ::std::convert::TryFrom<&str> for TitleObjectEncodeSubtype0Key { fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { - ::regress::Regex::new("^(?!interactive|name|style).+$").unwrap() + ::regress::Regex::with_flags("^(?!interactive|name|style).+$", "u").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^(?!interactive|name|style).+$\"".into()); diff --git a/typify/tests/schemas/id-or-name.rs b/typify/tests/schemas/id-or-name.rs index 1d3f2b13..0069c88c 100644 --- a/typify/tests/schemas/id-or-name.rs +++ b/typify/tests/schemas/id-or-name.rs @@ -177,7 +177,7 @@ impl ::std::convert::TryFrom<&str> for IdOrYoloYolo { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new(".*").unwrap()); + ::std::sync::LazyLock::new(|| ::regress::Regex::with_flags(".*", "u").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \".*\"".into()); } @@ -232,7 +232,7 @@ impl ::std::convert::TryFrom<&str> for Name { } static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new( || { - :: regress :: Regex :: new ("^(?![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}$)^[a-z][a-z0-9-]*[a-zA-Z0-9]$") . unwrap () + :: regress :: Regex :: with_flags ("^(?![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}$)^[a-z][a-z0-9-]*[a-zA-Z0-9]$" , "u") . unwrap () }, ); if PATTERN.find(value).is_none() { diff --git a/typify/tests/schemas/merged-schemas.rs b/typify/tests/schemas/merged-schemas.rs index 25b39cf2..ba12f242 100644 --- a/typify/tests/schemas/merged-schemas.rs +++ b/typify/tests/schemas/merged-schemas.rs @@ -393,7 +393,7 @@ impl ::std::convert::TryFrom<&str> for TriplePattern { fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(|| { - ::regress::Regex::new("(?=^[a-z].+$)(?=^.{4,8}$)(?=.+[a-z]$)").unwrap() + ::regress::Regex::with_flags("(?=^[a-z].+$)(?=^.{4,8}$)(?=.+[a-z]$)", "u").unwrap() }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"(?=^[a-z].+$)(?=^.{4,8}$)(?=.+[a-z]$)\"".into()); diff --git a/typify/tests/schemas/property-pattern.rs b/typify/tests/schemas/property-pattern.rs index 54652f5e..6f07646a 100644 --- a/typify/tests/schemas/property-pattern.rs +++ b/typify/tests/schemas/property-pattern.rs @@ -36,7 +36,9 @@ impl ::std::convert::TryFrom<&str> for TestGrammarForPatternPropertiesRulesKey { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("^[a-zA-Z_]\\w*$").unwrap()); + ::std::sync::LazyLock::new(|| { + ::regress::Regex::with_flags("^[a-zA-Z_]\\w*$", "u").unwrap() + }); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"^[a-zA-Z_]\\w*$\"".into()); } diff --git a/typify/tests/schemas/types-with-more-impls.rs b/typify/tests/schemas/types-with-more-impls.rs index c996bee4..69a81957 100644 --- a/typify/tests/schemas/types-with-more-impls.rs +++ b/typify/tests/schemas/types-with-more-impls.rs @@ -24,7 +24,7 @@ impl ::std::convert::TryFrom<&str> for PatternString { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new("xx").unwrap()); + ::std::sync::LazyLock::new(|| ::regress::Regex::with_flags("xx", "u").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \"xx\"".into()); } diff --git a/typify/tests/schemas/various-enums-json-schema.rs b/typify/tests/schemas/various-enums-json-schema.rs index 57540b41..862538ae 100644 --- a/typify/tests/schemas/various-enums-json-schema.rs +++ b/typify/tests/schemas/various-enums-json-schema.rs @@ -435,7 +435,7 @@ impl ::std::convert::TryFrom<&str> for Ipv4Net { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new(".*").unwrap()); + ::std::sync::LazyLock::new(|| ::regress::Regex::with_flags(".*", "u").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \".*\"".into()); } @@ -496,7 +496,7 @@ impl ::std::convert::TryFrom<&str> for Ipv6Net { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new(".*").unwrap()); + ::std::sync::LazyLock::new(|| ::regress::Regex::with_flags(".*", "u").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \".*\"".into()); } diff --git a/typify/tests/schemas/various-enums.rs b/typify/tests/schemas/various-enums.rs index 38a513f6..5e819ea7 100644 --- a/typify/tests/schemas/various-enums.rs +++ b/typify/tests/schemas/various-enums.rs @@ -386,7 +386,7 @@ impl ::std::convert::TryFrom<&str> for Ipv4Net { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new(".*").unwrap()); + ::std::sync::LazyLock::new(|| ::regress::Regex::with_flags(".*", "u").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \".*\"".into()); } @@ -437,7 +437,7 @@ impl ::std::convert::TryFrom<&str> for Ipv6Net { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { static PATTERN: ::std::sync::LazyLock<::regress::Regex> = - ::std::sync::LazyLock::new(|| ::regress::Regex::new(".*").unwrap()); + ::std::sync::LazyLock::new(|| ::regress::Regex::with_flags(".*", "u").unwrap()); if PATTERN.find(value).is_none() { return Err("doesn't match pattern \".*\"".into()); } From e2dcd8b149a912f7e036990527e5b3b84212f904 Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Sun, 15 Nov 2026 09:51:22 -0800 Subject: [PATCH 10/11] draft the 0.10.0 changelog --- CHANGELOG.adoc | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 38223696..09a80d32 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -15,6 +15,53 @@ https://github.com/oxidecomputer/typify/compare/v0.10.0-alpha.3\...HEAD[Full list of commits] +Type generation moves to the https://github.com/oxidecomputer/typespace[typespace] +crate. The schema-to-type translation is still typify's; typespace renders the +Rust code. The sections for the 0.10.0 alphas below record the steps; this is +the view from 0.8.0. + +*Builder API* + +* `TypeSpaceSettings` keeps what governs translation (`with_replacement`, + `with_patch`, `with_conversion`, `with_crate`, `with_unknown_crates`) and + hands everything about rendering to a `typespace::Settings` reached through + `map_typespace_settings`; `with_derive`, `with_attr`, `with_struct_builder`, + `with_map_type`, and `with_type_mod` are gone, as is `MapType` +* `TypeSpace::to_stream` returns a `Result`; `to_codespace` gives the rendered + code as a `codespace::Codespace` (one module per type group, or files) and + `to_typespace` the finished `typespace::Typespace` +* The `Type`, `TypeDetails`, `TypeEnum`, `TypeStruct`, and `TypeNewtype` views + are gone; `TypeSpace::inserted_type` answers the typespace type for an id and + the typespace crate is re-exported as `typify::typespace` +* A derive name is parsed by typespace: a trait it models is handled as that + trait, any other path is a foreign derive written on every type, and a bare + name that is neither is an error + +*Generated code* + +* Items are emitted in type-name order rather than in schema order +* Pattern checks compile the regex with the ECMA-262 `u` flag, as JSON Schema + specifies, so `\p{..}` and `\u{..}` escapes work; a pattern with an identity + escape the `u` flag forbids is now a generation error (#1103) +* A constrained string newtype does its validation in `TryFrom<&str>`, and a + non-string newtype no longer gets `TryFrom<&str>` or `TryFrom` + (#1078, #1079) +* The `error` module and shared default functions are emitted only when + something references them (#1080, #1082) +* `expect` with a message replaces `unwrap` in generated code (#1081) +* The 2024 keyword `gen` is no longer used as an identifier (#1074) +* Generated code depends on `json-serde` 1.x for flattened sequences and + the `Absent` type; the crate list a generator reports comes from codespace + (#1089) + +*Other* + +* A type named through `replace`, `convert`, or `x-rust-type` is assumed to + implement whatever the compiler can check rather than failing generation + for a trait typify cannot see (#1094) +* The minimum supported Rust version is 1.97, from typespace +* typespace 0.1.1 + == 0.10.0-alpha.3 (released 2026-10-14) https://github.com/oxidecomputer/typify/compare/v0.10.0-alpha.2\...v0.10.0-alpha.3[Full list of commits] From 346e241806f4920f5b156893b7d53c9cf600583e Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Sun, 15 Nov 2026 15:57:01 -0800 Subject: [PATCH 11/11] fix up changelog --- CHANGELOG.adoc | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 09a80d32..b112d7aa 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -15,27 +15,25 @@ https://github.com/oxidecomputer/typify/compare/v0.10.0-alpha.3\...HEAD[Full list of commits] -Type generation moves to the https://github.com/oxidecomputer/typespace[typespace] -crate. The schema-to-type translation is still typify's; typespace renders the -Rust code. The sections for the 0.10.0 alphas below record the steps; this is -the view from 0.8.0. +Type generation moves to the +https://github.com/oxidecomputer/typespace[typespace] crate. *Builder API* -* `TypeSpaceSettings` keeps what governs translation (`with_replacement`, - `with_patch`, `with_conversion`, `with_crate`, `with_unknown_crates`) and - hands everything about rendering to a `typespace::Settings` reached through - `map_typespace_settings`; `with_derive`, `with_attr`, `with_struct_builder`, - `with_map_type`, and `with_type_mod` are gone, as is `MapType` +* `TypeSpaceSettings` retains settings that modify translation (`with_replacement`, + `with_patch`, `with_conversion`, `with_crate`, `with_unknown_crates`); + everything pertaining to rendering is specified in `typespace::Settings` + which can be reached through `map_typespace_settings`; `with_derive`, + `with_attr`, `with_struct_builder`, `with_map_type`, and `with_type_mod` are + gone, as is `MapType` * `TypeSpace::to_stream` returns a `Result`; `to_codespace` gives the rendered - code as a `codespace::Codespace` (one module per type group, or files) and - `to_typespace` the finished `typespace::Typespace` + code as a `codespace::Codespace` and `to_typespace` produces the finished + `typespace::Typespace` * The `Type`, `TypeDetails`, `TypeEnum`, `TypeStruct`, and `TypeNewtype` views - are gone; `TypeSpace::inserted_type` answers the typespace type for an id and - the typespace crate is re-exported as `typify::typespace` -* A derive name is parsed by typespace: a trait it models is handled as that - trait, any other path is a foreign derive written on every type, and a bare - name that is neither is an error + are gone; `TypeSpace::inserted_type` may be used for queries +* A derive name is parsed by `typespace`: a trait it models is handled as that + trait, any other path is a foreign derive written on every type; a bare name + that is neither is an error *Generated code* @@ -48,19 +46,16 @@ the view from 0.8.0. (#1078, #1079) * The `error` module and shared default functions are emitted only when something references them (#1080, #1082) -* `expect` with a message replaces `unwrap` in generated code (#1081) * The 2024 keyword `gen` is no longer used as an identifier (#1074) -* Generated code depends on `json-serde` 1.x for flattened sequences and - the `Absent` type; the crate list a generator reports comes from codespace - (#1089) +* An `anyOf` construction with mixed types that previously generated an + unusable type now results in an error *Other* * A type named through `replace`, `convert`, or `x-rust-type` is assumed to implement whatever the compiler can check rather than failing generation for a trait typify cannot see (#1094) -* The minimum supported Rust version is 1.97, from typespace -* typespace 0.1.1 +* The minimum supported Rust version is 1.97 == 0.10.0-alpha.3 (released 2026-10-14)