I'm using axum + utoipa and suddenly I got a confliction error.
My app tried to use both axum 0.7.9 and 0.8.1 versions when I obviously set axum as 0.7.9 version. Then, I've find out that problem was caused by utoipa but.. when I changed some crates versions in Cargo.toml, Cargo.lock still contains old versions and its continue to download it. So, build fails and raising conflict error
Even if I delete /target and .lock manually or use cargo clean
with cargo update
, nothing helps.
Here is my Cargo.toml:
tokio = { version = "1.42.0", features = ["rt-multi-thread"] }
axum = { version = "0.7.9", features = ["json", "multipart", "query", "tokio"] }
utoipa = { version = "5.2.0", features = ["axum_extras"] }
utoipa-axum = "0.1.2"
utoipa-swagger-ui = { version = "8.0.3", features = ["axum"] }
axum-server = { version = "0.7.1", features = ["tls-rustls"] }
Apparently there's a semver bug in utoipa: v0.1.4 is supposed to be semver-compatible with v0.1.2 (since the first non-zero digit is the same) so cargo
picks that, but it requires axum
v0.8.1, which is not semver-compatible with v0.7.9 → so utoipa v0.1.4 can't be compatible with v0.1.2.
You can work around the issue by specifying an exact version requirement:
utoipa-axum = "=0.1.2"
utoipa-swagger-ui = { version = "=8.0.3", features = ["axum"] }