Skip to content

fix building crates standalone#34

Open
obbardc wants to merge 2 commits into
collabora:mainfrom
obbardc:wip/obbardc/fix-lava-api-mock-standalone
Open

fix building crates standalone#34
obbardc wants to merge 2 commits into
collabora:mainfrom
obbardc:wip/obbardc/fix-lava-api-mock-standalone

Conversation

@obbardc

@obbardc obbardc commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

The test suite calls Response::json() in several modules which reqwest gates behind its json feature. The dev-dependency on reqwest did not enable it.

This compiled only by accident: the tests depend on the workspace lava-api crate which enables reqwest/json.

When built standalone (e.g. from the published crate on crates.io) that sibling is absent; the "json" feature is not enabled, thus the tests fail to compile with:

error[E0599]: no method named `json` found for struct `Response`

Declare the json feature explicitly in lava-api-mock's dev-dependency so the tests build regardless of workspace context.

This can be reproduced with:

cargo package -p lava-api-mock --allow-dirty
cd target/package/lava-api-mock-0.2.1
cargo test

obbardc added 2 commits July 12, 2026 04:19
The test suite calls Response::json() in several modules which reqwest
gates behind its `json` feature. The dev-dependency on reqwest did not
enable it.

This compiled only by accident: the tests depend on the workspace
`lava-api` crate which enables reqwest/json.

When built standalone (e.g. from the published crate on crates.io) that
sibling is absent; the "json" feature is not enabled, thus the tests
fail to compile with:

    error[E0599]: no method named `json` found for struct `Response`

Declare the json feature explicitly in lava-api-mock's dev-dependency
so the tests build regardless of workspace context.

This can be reproduced with:

    cargo package -p lava-api-mock --allow-dirty
    cd target/package/lava-api-mock-0.2.1
    cargo test

Signed-off-by: Christopher Obbard <obbardc@gmail.com>
The crate example uses the lava-api client to read data back from the
mock LAVA server. Since lava-api dev-depends on lava-api-mock, compiling
this as a doctest introduces a dependency cycle: cargo package strips
the path-only lava-api dev-dependency, so a standalone build of
lava-api-mock fails to compile the doctest.

Mark the example as ignore so it is still rendered in the docs but not
compiled, allowing the crate to build standalone.

Signed-off-by: Christopher Obbard <obbardc@gmail.com>
@obbardc obbardc changed the title lava-api-mock: enable reqwest feature json fix building crates standalone Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant