Skip to content

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

Merged
softprops merged 1 commit intosoftprops:masterfrom
ic:search_rep_fix
Sep 29, 2018
Merged

Solution to the MissingFieldError problem on /images/search.#89
softprops merged 1 commit intosoftprops:masterfrom
ic:search_rep_fix

Conversation

@ic
Copy link
Copy Markdown
Contributor

@ic 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
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

Successfully merging this pull request may close these issues.

2 participants