Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,48 @@

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.

*Builder API*

* `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` and `to_typespace` produces the finished
`typespace::Typespace`
* The `Type`, `TypeDetails`, `TypeEnum`, `TypeStruct`, and `TypeNewtype` views
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*

* 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<String>`
(#1078, #1079)
* The `error` module and shared default functions are emitted only when
something references them (#1080, #1082)
* The 2024 keyword `gen` is no longer used as an identifier (#1074)
* 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

== 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]
Expand Down
66 changes: 33 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion cargo-typify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
36 changes: 26 additions & 10 deletions typify-impl/tests/vega.out
Original file line number Diff line number Diff line change
Expand Up @@ -7165,7 +7165,9 @@ impl ::std::convert::TryFrom<&str>
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
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());
}
Expand Down Expand Up @@ -7451,7 +7453,9 @@ impl ::std::convert::TryFrom<&str>
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
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());
}
Expand Down Expand Up @@ -7779,7 +7783,9 @@ impl ::std::convert::TryFrom<&str>
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
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());
}
Expand Down Expand Up @@ -8112,7 +8118,9 @@ impl ::std::convert::TryFrom<&str>
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
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());
}
Expand Down Expand Up @@ -8635,7 +8643,9 @@ impl ::std::convert::TryFrom<&str>
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
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());
}
Expand Down Expand Up @@ -8921,7 +8931,9 @@ impl ::std::convert::TryFrom<&str>
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
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());
}
Expand Down Expand Up @@ -9249,7 +9261,9 @@ impl ::std::convert::TryFrom<&str>
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
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());
}
Expand Down Expand Up @@ -9582,7 +9596,9 @@ impl ::std::convert::TryFrom<&str>
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
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());
}
Expand Down Expand Up @@ -11176,7 +11192,7 @@ impl ::std::convert::TryFrom<&str> for EncodeKey {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
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());
}
Expand Down Expand Up @@ -42548,7 +42564,7 @@ impl ::std::convert::TryFrom<&str> for TitleObjectEncodeSubtype0Key {
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
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());
Expand Down
Loading
Loading