diff --git a/.changepacks/changepack_log_Df5l-MonoWWam1dtfDfhT.json b/.changepacks/changepack_log_Df5l-MonoWWam1dtfDfhT.json new file mode 100644 index 0000000..913aec4 --- /dev/null +++ b/.changepacks/changepack_log_Df5l-MonoWWam1dtfDfhT.json @@ -0,0 +1 @@ +{"changes":{"crates/vespertide-config/Cargo.toml":"Patch","crates/vespertide-core/Cargo.toml":"Patch","crates/vespertide-planner/Cargo.toml":"Patch","crates/vespertide-query/Cargo.toml":"Patch","crates/vespertide-macro/Cargo.toml":"Patch","crates/vespertide-naming/Cargo.toml":"Patch","crates/vespertide/Cargo.toml":"Patch","crates/vespertide-loader/Cargo.toml":"Patch","crates/vespertide-exporter/Cargo.toml":"Patch","crates/vespertide-cli/Cargo.toml":"Patch"},"note":"Add vespera schema_type","date":"2026-02-03T17:13:06.154567800Z"} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index c2dc661..ca4a8c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2972,7 +2972,7 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "vespertide" -version = "0.1.40" +version = "0.1.41" dependencies = [ "vespertide-core", "vespertide-macro", @@ -2980,7 +2980,7 @@ dependencies = [ [[package]] name = "vespertide-cli" -version = "0.1.40" +version = "0.1.41" dependencies = [ "anyhow", "assert_cmd", @@ -3005,7 +3005,7 @@ dependencies = [ [[package]] name = "vespertide-config" -version = "0.1.40" +version = "0.1.41" dependencies = [ "clap", "schemars", @@ -3015,7 +3015,7 @@ dependencies = [ [[package]] name = "vespertide-core" -version = "0.1.40" +version = "0.1.41" dependencies = [ "rstest", "schemars", @@ -3027,7 +3027,7 @@ dependencies = [ [[package]] name = "vespertide-exporter" -version = "0.1.40" +version = "0.1.41" dependencies = [ "insta", "rstest", @@ -3038,7 +3038,7 @@ dependencies = [ [[package]] name = "vespertide-loader" -version = "0.1.40" +version = "0.1.41" dependencies = [ "anyhow", "rstest", @@ -3053,7 +3053,7 @@ dependencies = [ [[package]] name = "vespertide-macro" -version = "0.1.40" +version = "0.1.41" dependencies = [ "proc-macro2", "quote", @@ -3070,11 +3070,11 @@ dependencies = [ [[package]] name = "vespertide-naming" -version = "0.1.40" +version = "0.1.41" [[package]] name = "vespertide-planner" -version = "0.1.40" +version = "0.1.41" dependencies = [ "insta", "rstest", @@ -3085,7 +3085,7 @@ dependencies = [ [[package]] name = "vespertide-query" -version = "0.1.40" +version = "0.1.41" dependencies = [ "insta", "rstest", diff --git a/crates/vespertide-config/src/config.rs b/crates/vespertide-config/src/config.rs index f3fafaa..e1ecbbb 100644 --- a/crates/vespertide-config/src/config.rs +++ b/crates/vespertide-config/src/config.rs @@ -26,6 +26,10 @@ pub struct SeaOrmConfig { /// Default: `Camel` (generates `#[serde(rename_all = "camelCase")]`) #[serde(default = "default_enum_naming_case")] pub enum_naming_case: NameCase, + /// Generate `vespera::schema_type!` macro invocation for each entity. + /// Default: `true` + #[serde(default = "default_vespera_schema_type")] + pub vespera_schema_type: bool, } fn default_extra_enum_derives() -> Vec { @@ -36,12 +40,17 @@ fn default_enum_naming_case() -> NameCase { NameCase::Camel } +fn default_vespera_schema_type() -> bool { + true +} + impl Default for SeaOrmConfig { fn default() -> Self { Self { extra_enum_derives: default_extra_enum_derives(), extra_model_derives: Vec::new(), enum_naming_case: default_enum_naming_case(), + vespera_schema_type: default_vespera_schema_type(), } } } @@ -61,6 +70,11 @@ impl SeaOrmConfig { pub fn enum_naming_case(&self) -> NameCase { self.enum_naming_case } + + /// Whether to generate `vespera::schema_type!` macro invocation for each entity. + pub fn vespera_schema_type(&self) -> bool { + self.vespera_schema_type + } } /// Top-level vespertide configuration. @@ -192,6 +206,7 @@ mod tests { vec!["vespera::Schema".to_string()] ); assert!(config.seaorm.extra_model_derives.is_empty()); + assert!(config.seaorm.vespera_schema_type); assert_eq!(config.prefix, ""); } diff --git a/crates/vespertide-exporter/src/seaorm/mod.rs b/crates/vespertide-exporter/src/seaorm/mod.rs index f624609..658b727 100644 --- a/crates/vespertide-exporter/src/seaorm/mod.rs +++ b/crates/vespertide-exporter/src/seaorm/mod.rs @@ -156,6 +156,15 @@ pub fn render_entity_with_config( lines.push(String::new()); render_indexes(&mut lines, &table.constraints); + // Generate vespera::schema_type! macro if enabled + if config.vespera_schema_type() { + let pascal_name = to_pascal_case(&table.name); + lines.push(format!( + "vespera::schema_type!(Schema from Model, name = \"{}Schema\");", + pascal_name + )); + } + lines.push("impl ActiveModelBehavior for ActiveModel {}".into()); lines.push(String::new()); diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__integer_enum_default_value_snapshots@1.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__integer_enum_default_value_snapshots@1.snap index 9d125e8..7af27db 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__integer_enum_default_value_snapshots@1.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__integer_enum_default_value_snapshots@1.snap @@ -24,4 +24,5 @@ pub struct Model { pub status: TaskStatus, } +vespera::schema_type!(Schema from Model, name = "TasksSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__integer_enum_default_value_snapshots@pending_status.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__integer_enum_default_value_snapshots@pending_status.snap index cb1ef68..f090033 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__integer_enum_default_value_snapshots@pending_status.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__integer_enum_default_value_snapshots@pending_status.snap @@ -24,4 +24,5 @@ pub struct Model { pub status: TaskStatus, } +vespera::schema_type!(Schema from Model, name = "TasksSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_basic_single_pk.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_basic_single_pk.snap index ec6d11e..033e94c 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_basic_single_pk.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_basic_single_pk.snap @@ -13,4 +13,5 @@ pub struct Model { pub display_name: Option, } +vespera::schema_type!(Schema from Model, name = "UsersSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_composite_pk.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_composite_pk.snap index caee645..22a55a7 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_composite_pk.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_composite_pk.snap @@ -14,4 +14,5 @@ pub struct Model { pub tenant_id: i64, } +vespera::schema_type!(Schema from Model, name = "AccountsSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_multiple_columns.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_multiple_columns.snap index a9d81ee..75bc1f8 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_multiple_columns.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_multiple_columns.snap @@ -39,4 +39,5 @@ pub struct Model { pub availability: AvailabilityStatus, } +vespera::schema_type!(Schema from Model, name = "ProductsSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_nullable.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_nullable.snap index 9ce6272..8d79f1a 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_nullable.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_nullable.snap @@ -28,4 +28,5 @@ pub struct Model { pub priority: Option, } +vespera::schema_type!(Schema from Model, name = "TasksSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_shared.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_shared.snap index 9f816d1..844e2a7 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_shared.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_shared.snap @@ -27,4 +27,5 @@ pub struct Model { pub review_status: Option, } +vespera::schema_type!(Schema from Model, name = "DocumentsSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_special_values.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_special_values.snap index 3815631..ab5a0d0 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_special_values.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_special_values.snap @@ -28,4 +28,5 @@ pub struct Model { pub severity: EventSeverity, } +vespera::schema_type!(Schema from Model, name = "EventsSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_type.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_type.snap index b7fbc09..4bd0c74 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_type.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_type.snap @@ -26,4 +26,5 @@ pub struct Model { pub status: OrderStatus, } +vespera::schema_type!(Schema from Model, name = "OrdersSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_with_default.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_with_default.snap index bbe4b41..6f5f6dc 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_with_default.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_enum_with_default.snap @@ -31,4 +31,5 @@ pub struct Model { pub is_archived: bool, } +vespera::schema_type!(Schema from Model, name = "TasksSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_fk_composite.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_fk_composite.snap index 7373a9a..efcb3d1 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_fk_composite.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_fk_composite.snap @@ -16,4 +16,5 @@ pub struct Model { pub customers: HasOne, } +vespera::schema_type!(Schema from Model, name = "InvoicesSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_fk_single.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_fk_single.snap index 6ed1e92..5ef5656 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_fk_single.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_fk_single.snap @@ -16,4 +16,5 @@ pub struct Model { pub user: HasOne, } +vespera::schema_type!(Schema from Model, name = "PostsSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_inline_pk.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_inline_pk.snap index cd22e98..e88b3c2 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_inline_pk.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_inline_pk.snap @@ -13,4 +13,5 @@ pub struct Model { pub email: String, } +vespera::schema_type!(Schema from Model, name = "UsersSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_jsonb_custom_type.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_jsonb_custom_type.snap index c435bc3..a49f346 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_jsonb_custom_type.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_jsonb_custom_type.snap @@ -17,4 +17,5 @@ pub struct Model { pub jsonb_nullable: Option, } +vespera::schema_type!(Schema from Model, name = "JsonStructSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_pk_and_fk_together.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_pk_and_fk_together.snap index 07042e4..8b83f06 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_pk_and_fk_together.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_pk_and_fk_together.snap @@ -30,4 +30,5 @@ pub struct Model { // Index definitions (SeaORM uses Statement builders externally) // (unnamed) on [article_id] // (unnamed) on [user_id] +vespera::schema_type!(Schema from Model, name = "ArticleUserSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_table_level_pk.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_table_level_pk.snap index 40e6ab9..e4067f3 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_table_level_pk.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_table_level_pk.snap @@ -14,4 +14,5 @@ pub struct Model { pub total: f32, } +vespera::schema_type!(Schema from Model, name = "OrdersSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_unique_and_indexed.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_unique_and_indexed.snap index 833a6b9..048b49f 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_unique_and_indexed.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_snapshots@params_unique_and_indexed.snap @@ -23,4 +23,5 @@ pub struct Model { // Index definitions (SeaORM uses Statement builders externally) // idx_department on [department] +vespera::schema_type!(Schema from Model, name = "UsersSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_composite_fk_parent.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_composite_fk_parent.snap index 17d58ff..e8a7d1d 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_composite_fk_parent.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_composite_fk_parent.snap @@ -18,4 +18,5 @@ pub struct Model { pub child_manies: HasMany, } +vespera::schema_type!(Schema from Model, name = "ParentSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_many_to_many_article.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_many_to_many_article.snap index 97e3f3a..8f12ca8 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_many_to_many_article.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_many_to_many_article.snap @@ -16,4 +16,5 @@ pub struct Model { pub users: HasMany, } +vespera::schema_type!(Schema from Model, name = "ArticleSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_many_to_many_missing_target.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_many_to_many_missing_target.snap index 6c2fa31..beeff90 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_many_to_many_missing_target.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_many_to_many_missing_target.snap @@ -14,4 +14,5 @@ pub struct Model { pub article_users: HasMany, } +vespera::schema_type!(Schema from Model, name = "ArticleSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_many_to_many_user.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_many_to_many_user.snap index 0051629..bf88411 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_many_to_many_user.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_many_to_many_user.snap @@ -16,4 +16,5 @@ pub struct Model { pub articles: HasMany, } +vespera::schema_type!(Schema from Model, name = "UserSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_multiple_fk_same_table.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_multiple_fk_same_table.snap index 1e141de..f85c559 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_multiple_fk_same_table.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_multiple_fk_same_table.snap @@ -18,4 +18,5 @@ pub struct Model { pub used_by_user: HasOne, } +vespera::schema_type!(Schema from Model, name = "PostSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_multiple_has_one_relations.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_multiple_has_one_relations.snap index 5555998..0971fd7 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_multiple_has_one_relations.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_multiple_has_one_relations.snap @@ -16,4 +16,5 @@ pub struct Model { pub updated_by_user: HasOne, } +vespera::schema_type!(Schema from Model, name = "UserSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_multiple_reverse_relations.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_multiple_reverse_relations.snap index f59efe2..edc1642 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_multiple_reverse_relations.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_multiple_reverse_relations.snap @@ -16,4 +16,5 @@ pub struct Model { pub backup_user_profiles: HasMany, } +vespera::schema_type!(Schema from Model, name = "UserSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_not_junction_fk_not_in_pk_another.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_not_junction_fk_not_in_pk_another.snap index 34934c9..83cd804 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_not_junction_fk_not_in_pk_another.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_not_junction_fk_not_in_pk_another.snap @@ -14,4 +14,5 @@ pub struct Model { pub not_junctions: HasMany, } +vespera::schema_type!(Schema from Model, name = "AnotherSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_not_junction_fk_not_in_pk_other.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_not_junction_fk_not_in_pk_other.snap index ae694e0..965e4c9 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_not_junction_fk_not_in_pk_other.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_not_junction_fk_not_in_pk_other.snap @@ -14,4 +14,5 @@ pub struct Model { pub not_junctions: HasMany, } +vespera::schema_type!(Schema from Model, name = "OtherSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_not_junction_single_pk.snap b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_not_junction_single_pk.snap index b205bfe..1a78fcd 100644 --- a/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_not_junction_single_pk.snap +++ b/crates/vespertide-exporter/src/seaorm/snapshots/vespertide_exporter__seaorm__tests__render_entity_with_schema_snapshots@schema_not_junction_single_pk.snap @@ -14,4 +14,5 @@ pub struct Model { pub regulars: HasMany, } +vespera::schema_type!(Schema from Model, name = "OtherSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/snapshots/vespertide_exporter__orm__tests__render_entity_snapshots@seaorm.snap b/crates/vespertide-exporter/src/snapshots/vespertide_exporter__orm__tests__render_entity_snapshots@seaorm.snap index 475c0d3..8c01943 100644 --- a/crates/vespertide-exporter/src/snapshots/vespertide_exporter__orm__tests__render_entity_snapshots@seaorm.snap +++ b/crates/vespertide-exporter/src/snapshots/vespertide_exporter__orm__tests__render_entity_snapshots@seaorm.snap @@ -12,4 +12,5 @@ pub struct Model { pub id: i32, } +vespera::schema_type!(Schema from Model, name = "TestSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/vespertide-exporter/src/snapshots/vespertide_exporter__orm__tests__render_entity_with_schema_snapshots@seaorm.snap b/crates/vespertide-exporter/src/snapshots/vespertide_exporter__orm__tests__render_entity_with_schema_snapshots@seaorm.snap index 475c0d3..8c01943 100644 --- a/crates/vespertide-exporter/src/snapshots/vespertide_exporter__orm__tests__render_entity_with_schema_snapshots@seaorm.snap +++ b/crates/vespertide-exporter/src/snapshots/vespertide_exporter__orm__tests__render_entity_with_schema_snapshots@seaorm.snap @@ -12,4 +12,5 @@ pub struct Model { pub id: i32, } +vespera::schema_type!(Schema from Model, name = "TestSchema"); impl ActiveModelBehavior for ActiveModel {} diff --git a/schemas/config.schema.json b/schemas/config.schema.json index 050b59e..dc190be 100644 --- a/schemas/config.schema.json +++ b/schemas/config.schema.json @@ -43,7 +43,8 @@ "extraEnumDerives": [ "vespera::Schema" ], - "extraModelDerives": [] + "extraModelDerives": [], + "vesperaSchemaType": true } }, "tableNamingCase": { @@ -101,6 +102,11 @@ "items": { "type": "string" } + }, + "vesperaSchemaType": { + "description": "Generate `vespera::schema_type!` macro invocation for each entity.\nDefault: `true`", + "type": "boolean", + "default": true } } }