Skip to content

fix(rapina): re-export validator crate to fix unresolved import with #[derive(Validate)]#2

Closed
richasdev wants to merge 1 commit into
mainfrom
fix/511-validator-unresolved-import
Closed

fix(rapina): re-export validator crate to fix unresolved import with #[derive(Validate)]#2
richasdev wants to merge 1 commit into
mainfrom
fix/511-validator-unresolved-import

Conversation

@richasdev

Copy link
Copy Markdown
Owner

Summary

  • Adds pub use validator; to rapina/src/lib.rs so rapina::validator resolves as a path
  • Documents #[validate(crate = "rapina::validator")] requirement in all CLI-generated AI config files (AGENT.md, CLAUDE.md, cursor rules)

Root cause

validator_derive hardcodes validator:: in the generated code. Downstream projects only list rapina as a dependency — not validator — so the compiler cannot resolve the path, producing E0432/E0433.

Adding pub use validator; at the crate root makes rapina::validator a valid path, which is exactly what the #[validate(crate = "...")] attribute requires.

Test plan

  • cargo check -p rapina passes
  • cargo check -p rapina-cli passes
  • cargo test -p rapina-cli — 123 passed, 0 failed

Closes rapina-rs#511

validator_derive generates code hardcoding `validator::` paths.
Downstream crates only depend on `rapina`, so the path was
unresolvable — causing E0432/E0433 at compile time.

`pub use validator;` makes `rapina::validator` a valid path, enabling
`#[validate(crate = "rapina::validator")]` as the documented pattern.
CLI templates (AGENT.md, CLAUDE.md, cursor rules) updated to surface
this requirement when users add `Validate` to their structs.

Closes rapina-rs#511
@github-actions

Copy link
Copy Markdown

Thanks for your first PR! A maintainer will review it shortly.

Make sure CI passes and take a look at our contributing guide if you haven't already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: #[derive(Validate)] causes unresolved import validator when used outside the rapina crate

1 participant