Skip to content

Commit 884772a

Browse files
committed
Switch Validatable impl to use rustapi-core
Updated the macro in rustapi-macros to implement Validatable for ::rustapi_core instead of ::rustapi_rs, ensuring compatibility for crates that depend on rustapi-core directly. Added rustapi-core as a dependency in rustapi-validate.
1 parent 356f526 commit 884772a

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/rustapi-macros/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,12 +1441,14 @@ pub fn derive_validate(input: TokenStream) -> TokenStream {
14411441
};
14421442

14431443
// Generate the Validatable impl for rustapi-core integration (exposed via rustapi-rs)
1444+
// We use ::rustapi_core path because this macro is used in crates that might not depend on rustapi-rs directly
1445+
// (like rustapi-validate tests), but usually have access to rustapi-core (e.g. via dev-dependencies).
14441446
let validatable_impl = quote! {
1445-
impl #impl_generics ::rustapi_rs::validation::Validatable for #name #ty_generics #where_clause {
1446-
fn do_validate(&self) -> Result<(), ::rustapi_rs::ApiError> {
1447+
impl #impl_generics ::rustapi_core::validation::Validatable for #name #ty_generics #where_clause {
1448+
fn do_validate(&self) -> Result<(), ::rustapi_core::ApiError> {
14471449
match ::rustapi_validate::v2::Validate::validate(self) {
14481450
Ok(_) => Ok(()),
1449-
Err(e) => Err(::rustapi_rs::validation::convert_v2_errors(e)),
1451+
Err(e) => Err(::rustapi_core::validation::convert_v2_errors(e)),
14501452
}
14511453
}
14521454
}

crates/rustapi-validate/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ rustapi-macros = { workspace = true }
3838
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
3939
proptest = "1.4"
4040
rust-i18n = "3.0"
41+
rustapi-core = { workspace = true, default-features = false }

0 commit comments

Comments
 (0)