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

Solution to the MissingFieldError problem on /images/search. #89

Merged
merged 1 commit into from Sep 29, 2018

Conversation

Projects
None yet
2 participants
@ic
Copy link
Contributor

ic commented Aug 22, 2018

Symptoms

Searching images ends with an error:

Err(
    Decoding(
        MissingFieldError(
            "is_trusted"
        )
    )
)

Found

As far as I could check (Docker Engine API 1.18, now 1.37), I could not find the is_trusted field on the search response. In stead, there is an is_automated field, wich sounds similar. Anyway, it seems the API response payload has changed in a non-backward compatible fashion.

This PR replaces the old field with the new one, and search works fine again.

Test code

extern crate shiplift;
use shiplift::Docker;

let docker = Docker::new();
let images = docker.images();
let res = images.search("rust");
println!("{:#?}", res);

Response before fix

Err(
    Decoding(
        MissingFieldError(
            "is_trusted"
        )
    )
)

Response after fix

Ok(
    [
        SearchResult {
            description: "Rust is a systems programming language focused on safety, speed, and concurrency.",
            is_official: true,
            is_automated: false,
            name: "rust",
            star_count: 93
        },
         ...
    ]
)

@softprops softprops merged commit eec5876 into softprops:master Sep 29, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment