diff --git a/Cargo.lock b/Cargo.lock index 846a75dd..e4b3355c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3351,6 +3351,7 @@ dependencies = [ "stringprep", "thiserror", "url", + "uuid 1.3.0", "webpki-roots", "whoami", ] @@ -3594,7 +3595,7 @@ dependencies = [ "synth-gen", "tempfile", "uriparse", - "uuid 0.8.2", + "uuid 1.3.0", ] [[package]] @@ -3627,9 +3628,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.28.2" +version = "0.28.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e847e2de7a137c8c2cede5095872dbb00f4f9bf34d061347e36b43322acd56" +checksum = "b4c2f3ca6693feb29a89724516f016488e9aafc7f37264f898593ee4b942f31b" dependencies = [ "cfg-if 1.0.0", "core-foundation-sys", diff --git a/core/Cargo.toml b/core/Cargo.toml index ec00e1a1..8dbdf7f7 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -29,11 +29,11 @@ bincode = "1.3.1" num = { version = "0.4.0", features = [ "rand" ] } rand_regex = "0.15.1" synth-gen = { path = "../gen", features = [ "shared" ] } -uuid = { version = "0.8.2", features = ["v4"] } +uuid = { version = "1.2.2", features = ["v4", "serde"] } bimap = { version = "0.6.0", features = [ "std" ] } humantime-serde = "1.0.1" bloomfilter = "1.0.5" dynfmt = { version = "0.1.5", features = [ "curly" ] } -sqlx = { version = "0.6", features = ["postgres", "mysql", "runtime-async-std-rustls", "decimal", "chrono"] } +sqlx = { version = "0.6", features = ["postgres", "mysql", "runtime-async-std-rustls", "decimal", "chrono", "uuid"] } uriparse = "0.6.3" paste = "1.0" diff --git a/core/src/compile/mod.rs b/core/src/compile/mod.rs index cd6a8643..86cc9081 100644 --- a/core/src/compile/mod.rs +++ b/core/src/compile/mod.rs @@ -346,6 +346,15 @@ pub mod tests { assert!(complete(generator).unwrap().as_bool().unwrap()) } + #[test] + fn compile_uuid() { + let generator = generator! ({ + "type": "uuid" + }); + let value = complete(generator).unwrap(); + assert!(value.is_uuid()) + } + #[test] fn compile_linear() { let generator = generator!({ diff --git a/core/src/graph/json.rs b/core/src/graph/json.rs index 214ab909..2b35ce9e 100644 --- a/core/src/graph/json.rs +++ b/core/src/graph/json.rs @@ -9,6 +9,7 @@ pub fn synth_val_to_json(val: Value) -> serde_json::Value { Value::Bool(b) => serde_json::Value::Bool(b), Value::Number(n) => serde_json::Value::Number(synth_num_to_json(n)), Value::String(s) => serde_json::Value::String(s), + Value::Uuid(u) => serde_json::Value::String(u.hyphenated().to_string()), Value::DateTime(dt) => serde_json::Value::String(dt.format_to_string()), Value::Object(obj) => serde_json::Value::Object(synth_obj_to_json(obj)), Value::Array(arr) => serde_json::Value::Array(synth_arr_to_json(arr)), diff --git a/core/src/graph/mod.rs b/core/src/graph/mod.rs index f7626312..7f736b76 100644 --- a/core/src/graph/mod.rs +++ b/core/src/graph/mod.rs @@ -3,6 +3,7 @@ use std::collections::BTreeMap; use anyhow::{Context, Result}; +use ::uuid::Uuid; use chrono::{DateTime, FixedOffset, NaiveDate, NaiveDateTime, NaiveTime, Utc}; use sqlx::mysql::MySqlTypeInfo; use sqlx::postgres::{PgArgumentBuffer, PgTypeInfo}; @@ -23,7 +24,10 @@ pub mod null; pub use null::NullNode; pub mod string; -pub use string::{Format, FormatArgs, RandFaker, RandomString, StringNode, Truncated, UuidGen}; +pub use string::{Format, FormatArgs, RandFaker, RandomString, StringNode, Truncated}; + +pub mod uuid; +pub use self::uuid::UuidNode; pub mod date_time; pub use date_time::{DateTimeNode, RandomDateTime}; @@ -161,6 +165,7 @@ derive_from! { Bool(bool), Number(Number), String(String), + Uuid(Uuid), DateTime(ChronoValueAndFormat), Object(BTreeMap), Array(Vec), @@ -317,6 +322,7 @@ impl TryFrom for String { Value::String(str) => Ok(str), Value::Number(num) => Ok(num.to_string()), Value::DateTime(date) => Ok(date.format_to_string()), + Value::Uuid(u) => Ok(u.hyphenated().to_string()), otherwise => Err(failed_crate!( target: Release, "invalid type: expected 'String', found '{}'", @@ -397,6 +403,7 @@ impl Value { Self::Object(_) => { serde_json::to_string(&json::synth_val_to_json(self.clone())).unwrap() } + Self::Uuid(uid) => uid.hyphenated().to_string(), } } @@ -409,6 +416,7 @@ impl Value { // Based on https://docs.rs/sqlx-core/0.5.9/sqlx_core/postgres/types/index.html while let Some(c) = current { let pair = match c { + Value::Uuid(_) => (None, "uuid"), Value::Null(_) => (None, "unknown"), Value::Bool(_) => (None, "bool"), Value::Number(num) => match *num { @@ -501,6 +509,7 @@ impl Encode<'_, Postgres> for Value { json::synth_val_to_json(self.clone()), buf, ), + Value::Uuid(u) => >::encode_by_ref(u, buf), Value::Array(_) => { let s = self.to_postgres_string(); >::encode_by_ref(&s, buf) @@ -553,6 +562,7 @@ impl Encode<'_, MySql> for Value { buf, ), Value::Array(_arr) => todo!(), // as Encode<'_, MySql>>::encode_by_ref(arr, buf), //TODO special-case for u8 arrays? + Value::Uuid(u) => >::encode_by_ref(u, buf), } } @@ -583,6 +593,7 @@ impl Encode<'_, MySql> for Value { ChronoValue::DateTime(_) => as Type>::type_info(), }, Value::String(_) => >::type_info(), + Value::Uuid(_) => >::type_info(), Value::Object(_) => return None, //TODO: Use JSON here? Value::Array(elems) => { if elems.is_empty() { @@ -623,6 +634,10 @@ impl Value { self.as_object().is_some() } + pub fn is_uuid(&self) -> bool { + self.as_uuid().is_some() + } + pub fn is_array(&self) -> bool { self.as_array().is_some() } @@ -669,6 +684,13 @@ impl Value { } } + pub fn as_uuid(&self) -> Option<&Uuid> { + match *self { + Value::Uuid(ref u) => Some(u), + _ => None, + } + } + pub fn as_array(&self) -> Option<&Vec> { match *self { Value::Array(ref vec) => Some(vec), @@ -714,6 +736,13 @@ impl Value { } } + pub fn as_uuid_mut(&mut self) -> Option<&mut Uuid> { + match *self { + Value::Uuid(ref mut u) => Some(u), + _ => None, + } + } + pub fn as_array_mut(&mut self) -> Option<&mut Vec> { match *self { Value::Array(ref mut vec) => Some(vec), @@ -777,6 +806,7 @@ derive_generator!( DateTime(DateTimeNode), Object(ObjectNode), Array(ArrayNode), + Uuid(UuidNode), OneOf(OneOfNode), Series(SeriesNode), Unique(UniqueNode), diff --git a/core/src/graph/string/mod.rs b/core/src/graph/string/mod.rs index 553bfa7d..7c31fbba 100644 --- a/core/src/graph/string/mod.rs +++ b/core/src/graph/string/mod.rs @@ -8,9 +8,7 @@ pub mod format; pub mod serialized; pub mod sliced; pub mod truncated; -pub mod uuid; -pub use self::uuid::UuidGen; pub use constant::Constant; pub use faker::{FakerArgs, Locale, RandFaker}; pub use format::{Format, FormatArgs}; @@ -26,7 +24,6 @@ derive_generator! { Faker(TryOnce), Serialized(TryOnce) Categorical(OnceInfallible>>) - Uuid(OnceInfallible), Format(Format), Truncated(Truncated), Sliced(Sliced), @@ -58,12 +55,6 @@ impl From> for RandomString { } } -impl From for RandomString { - fn from(uuid: UuidGen) -> Self { - Self::Uuid(uuid.infallible().try_once()) - } -} - impl From for RandomString { fn from(trunc: Truncated) -> Self { Self::Truncated(trunc) diff --git a/core/src/graph/string/uuid.rs b/core/src/graph/string/uuid.rs deleted file mode 100644 index 54a10842..00000000 --- a/core/src/graph/string/uuid.rs +++ /dev/null @@ -1,15 +0,0 @@ -use crate::graph::prelude::{Generator, GeneratorState, Rng}; -use synth_gen::Never; -use uuid::Uuid; - -pub struct UuidGen {} - -impl Generator for UuidGen { - type Yield = String; - type Return = Never; - - fn next(&mut self, rng: &mut R) -> GeneratorState { - let uuid = Uuid::from_u128(rng.gen()); - GeneratorState::Yielded(uuid.to_hyphenated().to_string()) - } -} diff --git a/core/src/graph/uuid.rs b/core/src/graph/uuid.rs new file mode 100644 index 00000000..1dfcf06e --- /dev/null +++ b/core/src/graph/uuid.rs @@ -0,0 +1,26 @@ +use super::prelude::*; +use uuid::Uuid; + +derive_generator! { + yield Token, + return Result, + pub struct UuidNode(Valuize, Uuid>); +} + +impl From for UuidNode { + fn from(value: RandomUuid) -> Self { + Self(value.into_token().map_complete(value_from_ok::)) + } +} + +pub struct RandomUuid {} + +impl Generator for RandomUuid { + type Yield = Token; + type Return = Result; + + fn next(&mut self, rng: &mut R) -> GeneratorState { + let uuid = Uuid::from_u128(rng.gen()); + GeneratorState::Complete(Ok(uuid)) + } +} diff --git a/core/src/schema/content/mod.rs b/core/src/schema/content/mod.rs index 5f0ee07e..d0978f8d 100644 --- a/core/src/schema/content/mod.rs +++ b/core/src/schema/content/mod.rs @@ -30,7 +30,7 @@ pub use number::{number_content, NumberContent, NumberContentKind, NumberKindExt mod string; pub use string::{ ConstantContent, FakerContent, FakerContentArgument, FormatContent, RegexContent, - SlicedContent, StringContent, Uuid, + SlicedContent, StringContent, }; mod date_time; @@ -44,6 +44,9 @@ pub use array::ArrayContent; mod object; pub use object::ObjectContent; +mod uuid; +pub use self::uuid::UuidContent; + mod datasource; pub use datasource::DatasourceContent; @@ -305,9 +308,10 @@ content! { labels: ContentLabels, variants: { Null(NullContent) => None, + Uuid(UuidContent) => None, Bool(BoolContent) => "missing a subtype. Try adding `constant`, or `frequency`", Number(NumberContent) => "missing a subtype. Try adding `constant`, `range`, or `id`", - String(StringContent) => "missing a subtype. Try adding `pattern`, `faker`, `categorical`, `serialized`, `uuid`, `truncated`, or `format`", + String(StringContent) => "missing a subtype. Try adding `pattern`, `faker`, `categorical`, `serialized`, `truncated`, or `format`", DateTime(DateTimeContent) => "missing a `format` field", Array(ArrayContent) => "missing a `length` and `content` field", Object(ObjectContent) => None, @@ -498,6 +502,7 @@ impl Content { pub fn kind(&self) -> String { match self { + Content::Uuid(_) => "uuid".to_string(), Content::Null(_) => "null".to_string(), Content::Bool(content) => format!("bool::{}", content.kind()), Content::Number(content) => format!("number::{}", content.kind()), @@ -632,6 +637,7 @@ impl Compile for Content { Self::Object(object_content) => object_content.compile(compiler), Self::Bool(bool_content) => bool_content.compile(compiler), Self::String(string_content) => string_content.compile(compiler), + Self::Uuid(uuid_content) => uuid_content.compile(compiler), Self::DateTime(date_time_content) => date_time_content.compile(compiler), Self::Number(number_content) => number_content.compile(compiler), Self::Array(array_content) => array_content.compile(compiler), @@ -705,8 +711,7 @@ pub mod tests { "type": "object", "skip_when_null": true, "_uuid": { - "type": "string", - "uuid": {}, + "type": "uuid", "hidden": true }, "user_id": { @@ -901,7 +906,7 @@ pub mod tests { #[test] #[should_panic( - expected = "`string` generator is missing a subtype. Try adding `pattern`, `faker`, `categorical`, `serialized`, `uuid`, `truncated`, or `format`" + expected = "`string` generator is missing a subtype. Try adding `pattern`, `faker`, `categorical`, `serialized`, `truncated`, or `format`" )] fn string_missing_subtype() { let _schema: Content = schema!({ diff --git a/core/src/schema/content/string.rs b/core/src/schema/content/string.rs index 0c7ebc4d..3e4f3e5e 100644 --- a/core/src/schema/content/string.rs +++ b/core/src/schema/content/string.rs @@ -13,16 +13,12 @@ pub enum StringContent { Faker(FakerContent), Categorical(Categorical), Serialized(SerializedContent), - Uuid(Uuid), Truncated(TruncatedContent), Sliced(SlicedContent), Format(FormatContent), Constant(ConstantContent), } -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] -pub struct Uuid; - impl StringContent { pub fn kind(&self) -> String { match self { @@ -30,7 +26,6 @@ impl StringContent { Self::Faker(faker) => faker.kind(), Self::Categorical(_) => "categorical".to_string(), Self::Serialized(_) => "serialized".to_string(), - Self::Uuid(_) => "uuid".to_string(), Self::Truncated(_) => "truncated".to_string(), Self::Sliced(_) => "sliced".to_string(), Self::Constant(_) => "constant".to_string(), @@ -352,7 +347,6 @@ impl Compile for StringContent { StringContent::Constant(ConstantContent(s)) => { RandomString::from(Constant(s.into())).into() } - StringContent::Uuid(_uuid) => RandomString::from(UuidGen {}).into(), }; Ok(Graph::String(string_node)) } diff --git a/core/src/schema/content/uuid.rs b/core/src/schema/content/uuid.rs new file mode 100644 index 00000000..057f9cbb --- /dev/null +++ b/core/src/schema/content/uuid.rs @@ -0,0 +1,14 @@ +use super::prelude::*; +use crate::graph::uuid::RandomUuid; + +#[derive(Default, Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] +#[serde(rename_all = "snake_case")] +#[serde(deny_unknown_fields)] +pub struct UuidContent {} + +impl Compile for UuidContent { + fn compile<'a, C: Compiler<'a>>(&'a self, mut _compiler: C) -> Result { + let random_uuid = RandomUuid {}; + Ok(Graph::Uuid(random_uuid.into())) + } +} diff --git a/core/src/schema/inference/mod.rs b/core/src/schema/inference/mod.rs index 842736d9..510aae57 100644 --- a/core/src/schema/inference/mod.rs +++ b/core/src/schema/inference/mod.rs @@ -126,7 +126,6 @@ impl MergeStrategy for OptionalMergeStrategy { } StringContent::Faker(_) => Ok(()), StringContent::Serialized(_) => Ok(()), // we can probably do better here - StringContent::Uuid(_) => Ok(()), StringContent::Truncated(_) => Ok(()), StringContent::Sliced(_) => Ok(()), StringContent::Constant(_) => Ok(()), diff --git a/docs/blog/2021-08-31-seeding-databases-tutorial.md b/docs/blog/2021-08-31-seeding-databases-tutorial.md index 8bf665f9..48be7ea2 100644 --- a/docs/blog/2021-08-31-seeding-databases-tutorial.md +++ b/docs/blog/2021-08-31-seeding-databases-tutorial.md @@ -550,7 +550,6 @@ identified by the presence of a distinguishing field which can be - `"faker"` - `"pattern"` -- `"uuid"` - [and a lot more][synth-string]... Since we are interested in generating email addresses, we will be using @@ -884,4 +883,4 @@ community would be happy to help if you encounter an issue! [npm-script]: https://github.com/brokad/synth/tree/master/examples/message_board/helpers/db.js -[prisma-relation-mongo]: https://www.prisma.io/docs/concepts/components/prisma-schema/relations/one-to-many-relations \ No newline at end of file +[prisma-relation-mongo]: https://www.prisma.io/docs/concepts/components/prisma-schema/relations/one-to-many-relations diff --git a/docs/docs/content/index.md b/docs/docs/content/index.md index 08ea6614..59ef0f8e 100644 --- a/docs/docs/content/index.md +++ b/docs/docs/content/index.md @@ -9,6 +9,7 @@ Synth has the following types of generators: * [null](null) generates as many nulls as you ever want * [bool](bool) generates `true` or `false`, either constant or following a given percentage +* [uuid](uuid) generates UUIDs * [number](number) generates ranges, distributions or series of [integer or floating-point](number#subtype) numbers * [series](series) generates streams of events (e.g. for logs) @@ -20,8 +21,6 @@ following a given percentage various classes of string: * [pattern](string#pattern) takes a regular expression and generates matching strings - * [uuid](string#uuid) generates hyphenated UUIDs - optionally with time zone * [faker](string#faker) has a large number of generators for names, contact information, credit card numbers, sentences, and much more * [format](string#format) combines multiple generators to one @@ -50,4 +49,4 @@ like a file * [one_of](one-of) allows you to choose from a set of contained generators * [same_as](same-as) creates a reference to another field in this or - another collection \ No newline at end of file + another collection diff --git a/docs/docs/content/string.md b/docs/docs/content/string.md index 4878efa9..c80527ec 100644 --- a/docs/docs/content/string.md +++ b/docs/docs/content/string.md @@ -15,21 +15,6 @@ String values generated by a specified regular expression in the `pattern` key. } ``` -## uuid - -`uuid` generates hyphenated [UUIDs](https://en.wikipedia.org/wiki/Universally_unique_identifier). - -This generator has no parameters. - -#### Example - -```json synth -{ - "type": "string", - "uuid": {} -} -``` - ## format `format` allows to format one or more string values by parsing a parametric diff --git a/docs/docs/content/toc.md b/docs/docs/content/toc.md index 7e18c563..de9e6a0a 100644 --- a/docs/docs/content/toc.md +++ b/docs/docs/content/toc.md @@ -22,6 +22,7 @@ another collection * [null](/content/null) generates as many nulls as you ever want * [bool](/content/bool) generates `true` or `false`, either constant or following a given percentage +* [uuid](/content/uuid) generates UUIDs * [number](/content/number) generates ranges, distributions or series of [integer or floating-point](/content/number#subtype) numbers * [series](/content/series) generates streams of events (e.g. for logs) @@ -33,8 +34,6 @@ following a given percentage various classes of string: * [pattern](/content/string#pattern) takes a regular expression and generates matching strings - * [uuid](/content/string#uuid) generates hyphenated UUIDs - optionally with time zone * [faker](/content/string#faker) has a large number of generators for names, contact information, credit card numbers, sentences, and much more * [format](/content/string#format) combines multiple generators to one diff --git a/docs/docs/content/uuid.md b/docs/docs/content/uuid.md new file mode 100644 index 00000000..69b87f6f --- /dev/null +++ b/docs/docs/content/uuid.md @@ -0,0 +1,13 @@ +## uuid + +`uuid` generates hyphenated [UUIDs](https://en.wikipedia.org/wiki/Universally_unique_identifier). + +This generator has no parameters. + +#### Example + +```json synth +{ + "type": "uuid" +} +``` diff --git a/docs/docs/integrations/postgres.md b/docs/docs/integrations/postgres.md index 4168c280..aee5d09c 100644 --- a/docs/docs/integrations/postgres.md +++ b/docs/docs/integrations/postgres.md @@ -73,7 +73,7 @@ table formatter: https://codebeautify.org/markdown-formatter | timestamptz | [date_time](../content/date-time) | | timestamp | [naive_date_time](../content/date-time) | | date | [naive_date](../content/date-time) | -| uuid | [string](../content/string#uuid) | +| uuid | [uuid](../content/uuid) | ### Example Import diff --git a/docs/docs/other/telemetry.md b/docs/docs/other/telemetry.md index 23dd401c..727f092c 100644 --- a/docs/docs/other/telemetry.md +++ b/docs/docs/other/telemetry.md @@ -79,8 +79,7 @@ activity: { "type": "object", "distinct_id": { - "type": "string", - "uuid": {} + "type": "uuid" }, "command": { "type": "string", diff --git a/docs/sidebars.js b/docs/sidebars.js index 3dc5ef52..5f5dfe77 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -4,7 +4,7 @@ module.exports = { "Examples": ['examples/bank'], "Tutorials": ['tutorials/creating-logs-with-synth'], "Integrations": ['integrations/index', 'integrations/postgres', 'integrations/mysql'], - "Generators": ['content/index', 'content/modifiers', 'content/null', 'content/bool', 'content/number', 'content/string', 'content/date-time', 'content/object', 'content/array', 'content/one-of', 'content/same-as', 'content/unique', 'content/series', 'content/datasource'], + "Generators": ['content/index', 'content/modifiers', 'content/null', 'content/bool', 'content/uuid', 'content/number', 'content/string', 'content/date-time', 'content/object', 'content/array', 'content/one-of', 'content/same-as', 'content/unique', 'content/series', 'content/datasource'], "Other": ['other/telemetry'] }, }; diff --git a/synth/Cargo.toml b/synth/Cargo.toml index 47db4a10..38342190 100644 --- a/synth/Cargo.toml +++ b/synth/Cargo.toml @@ -46,7 +46,7 @@ log = "0.4.11" env_logger = "0.7.1" num_cpus = "1.0" -sysinfo = "0.28.2" +sysinfo = "0.28.4" strsim = "0.10.0" async-std = { version = "1.6.4", features = [ "attributes", "unstable" ] } @@ -67,7 +67,7 @@ rust_decimal = "1.10.3" indicatif = "0.15.0" dirs = "3.0.2" -mongodb = {version = "2.0.0-beta.3", features = ["sync", "bson-chrono-0_4"] , default-features = false} +mongodb = {version = "2.4.0", features = ["sync", "bson-chrono-0_4"] , default-features = false} sqlx = { version = "0.6", features = ["postgres", "mysql", "runtime-async-std-rustls", "decimal", "chrono"] } diff --git a/synth/src/cli/csv/mod.rs b/synth/src/cli/csv/mod.rs index cf048189..51eda2a0 100644 --- a/synth/src/cli/csv/mod.rs +++ b/synth/src/cli/csv/mod.rs @@ -308,6 +308,7 @@ fn to_csv_string(collection_name: String, value: Value, namespace: &Namespace) - fn synth_val_to_csv_record(val: Value, content: &Content, namespace: &Namespace) -> Vec { match val { + Value::Uuid(u) => vec![u.hyphenated().to_string()], Value::Null(_) => vec![String::new()], Value::Bool(b) => vec![b.to_string()], Value::Number(n) => { diff --git a/synth/src/cli/mongo.rs b/synth/src/cli/mongo.rs index 24b4ac32..de7ae723 100644 --- a/synth/src/cli/mongo.rs +++ b/synth/src/cli/mongo.rs @@ -211,6 +211,7 @@ impl MongoExportStrategy { fn value_to_bson(value: Value) -> Bson { match value { + Value::Uuid(u) => Bson::String(u.hyphenated().to_string()), Value::Null(_) => Bson::Null, Value::Bool(b) => Bson::Boolean(b), Value::Number(n) => number_to_bson(n), diff --git a/synth/src/datasource/postgres_datasource.rs b/synth/src/datasource/postgres_datasource.rs index d73794b0..2fcd78d6 100644 --- a/synth/src/datasource/postgres_datasource.rs +++ b/synth/src/datasource/postgres_datasource.rs @@ -15,7 +15,8 @@ use std::convert::TryFrom; use synth_core::schema::number_content::{F32, F64, I16, I32, I64}; use synth_core::schema::{ ArrayContent, BoolContent, Categorical, ChronoValue, ChronoValueAndFormat, ChronoValueType, - DateTimeContent, NumberContent, ObjectContent, RangeStep, RegexContent, StringContent, Uuid, + DateTimeContent, NumberContent, ObjectContent, RangeStep, RegexContent, StringContent, + UuidContent, }; use synth_core::{Content, Value}; @@ -232,7 +233,7 @@ impl SqlxDataSource for PostgresDataSource { skip_when_null: false, fields: BTreeMap::new(), }), - "uuid" => Content::String(StringContent::Uuid(Uuid)), + "uuid" => Content::Uuid(UuidContent {}), _ => { if let Some(data_type) = column_info.data_type.strip_prefix('_') { let mut column_info = column_info.clone(); diff --git a/synth/testing_harness/errors/generate/192-string-missing-subtype/errors.txt b/synth/testing_harness/errors/generate/192-string-missing-subtype/errors.txt index ea695d81..dbc4aa43 100644 --- a/synth/testing_harness/errors/generate/192-string-missing-subtype/errors.txt +++ b/synth/testing_harness/errors/generate/192-string-missing-subtype/errors.txt @@ -3,4 +3,4 @@ Error: Unable to open the namespace "generate/192-string-missing-subtype" Caused by: 0: at file generate/192-string-missing-subtype/schema.json 1: Failed to parse collection - 2: `string` generator is missing a subtype. Try adding `pattern`, `faker`, `categorical`, `serialized`, `uuid`, `truncated`, or `format` at line 10 column 1 + 2: `string` generator is missing a subtype. Try adding `pattern`, `faker`, `categorical`, `serialized`, `truncated`, or `format` at line 10 column 1