-
Notifications
You must be signed in to change notification settings - Fork 70
chore(syncserver): break up extractors.rs #1831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c073b18 to
8b598dc
Compare
syncserver/src/web/extractors/mod.rs
Outdated
| mod constants; | ||
| pub use constants::*; | ||
| mod utils; | ||
| pub use utils::*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't come up with good name for this. :-/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I would get heart palpitations every time I opened the extractors.rs file. This really helps. Let @pjenvey take a look too, but looks great. Thanks for doing this
pjenvey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really have that many extractors? that's a lot of extractors. thanks!
| } | ||
|
|
||
| #[test] | ||
| fn test_invalid_query_args() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also move these tests into their specific modules (e.g. bso_query_params) but totally fine for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move these tests into their specific modules
Oh yeah, my bad. I should've done that in the first place; that's my preference as well.
| @@ -0,0 +1,56 @@ | |||
| use crate::web::extractors::{ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple nitpicks here that I won't block on:
- we're not consistent but we try to organize imports by a grouping of std/external/crate separated by a newline. rustfmt doesn't enforce this but I'll note it has an option for this grouping in nightly, "StdExternalCrate". So this
crateblock would go below the last import, separated by a newline like in batch_request.rs - You could also replace
crate::web::extractors::withsuper::(or more specificallysuper::validation::here) -- not just because it's shorter but I think it could help avoid wildcard imports in mod.rs. Ideally mod.rs would onlypub usewhat's exposed outside ofextractorsvs internal -- e.g. everything invalidation.rsis internal and doesn't needpubinmod.rs. But I'm not complaining, still beats 2k lines of extractors.rs
| @@ -0,0 +1,50 @@ | |||
| use serde::Deserialize; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot my only actual request: could you move the contents of this module into bso_query_params.rs? As it's specific to there and doesn't have its own FromRequest
67fbec6 to
7678e88
Compare
7678e88 to
3404150
Compare
Description
sync server's extractors.rs was quite large. This patch simply breaks it up. There are no type or functionality changes.
Testing
Existing tests should pass.
Issue(s)
Closes STOR-367 / #1820