-
-
Notifications
You must be signed in to change notification settings - Fork 309
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
hydra-api.yaml returns an object when getting evals causing deserialization to fail #1430
Comments
I could implement a fix on my end and just manually create an implementation of |
After looking into it more, this json doesn't represent a |
After changing the function signature's return type to reflect this, the deserialization still fails:
|
maybe it's just unhappy with the 0 = false and 1 = true scheme when deserializing boolean values? |
OK, after a bit of debugging here I got it to work. There are three issues:
I haven't checked the hydra-api.yaml file for these things, but maybe there's a way to update it so that the generated bindings are correct? Otherwise this could just be an issue with the generator I used. |
Running into the same issue with getting builds for some eval. Here's the code: pub async fn eval_eval_id_builds_get(
configuration: &configuration::Configuration,
eval_id: i32,
) -> Result<Vec<std::collections::HashMap<String, models::Build>>, Error<EvalEvalIdBuildsGetError>>
{
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/eval/{}/builds",
local_var_configuration.base_path, eval_id
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
dbg!(&local_var_content);
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<EvalEvalIdBuildsGetError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
} The return type is sort of crazy here, not sure why it expects a vector of hashmaps. The json output is just an array of builds, as expected. |
Describe the bug
A clear and concise description of what the bug is.
Ref #1427 I'm working on creating a tool in Rust and I've used the open api and openapi-generator-cli to create some Rust bindings. This function was generated from the openapi-generator-cli so it's also possible this is the fault of that, but just in case I'm reporting here as well. This particular function is supposed to return an array of evals (just like how the function for getting jobsets returns a json array of jobsets), at least that's what the function signature indicates, however what is actually returned is an object with a field "evals" which contains the array. This causes deserialization to fail.
To Reproduce
Steps to reproduce the behavior:
See #1427
Expected behavior
A clear and concise description of what you expected to happen.
I just expected the api to return an array of evals, just like it does for jobsets, since the api seems to indicate that's what it should return.
Screenshots
If applicable, add screenshots to help explain your problem.
Here's the code:
Output as described above:
Hydra Server:
Please fill out this data as well as you can, but don't worry if you can't -- just do your best.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: