Skip to content
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

"Missing field 'visibility'" error #6

Closed
itripn opened this issue Apr 30, 2024 · 1 comment
Closed

"Missing field 'visibility'" error #6

itripn opened this issue Apr 30, 2024 · 1 comment

Comments

@itripn
Copy link

itripn commented Apr 30, 2024

Hi, I had some code that was working fine until a few days ago, when with no changes the code I started getting:

{ kind: Decode, source: Error("missing field visibility", line: 1, column: 5505) }

This is not production code, just some experimental code I am playing with. Simplest form is:

#[tokio::main]
async fn main() {
    let openweather = OpenWeather::new(
        "MY_API_KEY".to_string(),
        Units::Imperial,
        Language::English,
    );

    let lat = 45.861409;
    let lon = -123.183515;

    let response = openweather.one_call.call(lat, lon).await;

    println!("{:?}", response.unwrap()); // program panics here with message above

}

Using 0.1.5 of the crate in my dependencies.

Would appreciate any pointers as to what I'm doing wrong...

@itripn itripn closed this as completed May 6, 2024
@jt-rose
Copy link
Owner

jt-rose commented May 14, 2024

Were you able to figure out the issue?

One challenge I've had with the OpenWeather API is that not all fields are always present, but their documentation doesn't mark what is nullable. While we could just mark every field as optional, that would get really tedious, as most of them are consistently present.

I've tested it enough that I think I've pinned down the nullable fields, but it's definitely possible "visibility" should be marked as optional. I'm happy to update that if you were able to confirm it was not included in your response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants