fix: malformed search facet generation - #18
Conversation
|
Got ahead of myself... While this does fix the incorrect formatting (Modrinth doesn't have a space included in their documentation for search facets https://docs.modrinth.com/api/operations/searchprojects/ ) it doesn't fully fix #17 as the URL generated isn't properly formatted. This was figured out by shoving a println!() into line 90 here ferinth/src/api_calls/search.rs Lines 75 to 93 in ccaf0c5 url created looks like and opening that URL with firefox.
This sample code with a println! at L90 use ferinth::{self, structures::{project::ProjectType::Mod, search::{Facet::{Categories, ProjectType, Versions}, Sort}}};
#[tokio::main]
async fn main() {
let client = ferinth::Ferinth::default();
let search = client.search(&"knowlogy", &Sort::Relevance, vec![vec![ProjectType(Mod)], vec![Categories("neoforge".to_string())], vec![Versions("1.21.1".to_string())]]).await;
match search {
Ok(response) => {
println!("Search results: {:?}", response);
}
Err(e) => {
eprintln!("Error searching modrinth: {:?}", e);
}
}
}will produce |
|
I encountered the same issue about a month ago. The problem is actually that the ferinth/src/structures/search.rs Lines 53 to 55 in ccaf0c5 The ferinth/src/structures/project.rs Lines 198 to 210 in ccaf0c5 However, this never happens because, like I said, instead of being serialized it's just debug formatted. This is how the fix would look like: |
Fixes #17