GREsau/okapi

Conflict with kube-rs when importing rocket-okapi

korewaChino opened this issue · 2 comments

error[E0308]: mismatched types
  --> /home/cappy/.cargo/registry/src/github.com-1ecc6299db9ec823/kube-core-0.74.0/src/schema.rs:68:29
   |
67 |                         match common_obj.properties.entry(property_name) {
   |                               ------------------------------------------ this expression has type `indexmap::map::core::Entry<'_, std::string::String, schemars::schema::Schema>`
68 |                             Entry::Occupied(entry) => panic!(
   |                             ^^^^^^^^^^^^^^^^^^^^^^ expected enum `indexmap::map::core::Entry`, found enum `std::collections::btree_map::Entry`
   |
   = note: expected enum `indexmap::map::core::Entry<'_, std::string::String, schemars::schema::Schema>`
              found enum `std::collections::btree_map::Entry<'_, _, _>`

error[E0308]: mismatched types
  --> /home/cappy/.cargo/registry/src/github.com-1ecc6299db9ec823/kube-core-0.74.0/src/schema.rs:72:29
   |
67 |                         match common_obj.properties.entry(property_name) {
   |                               ------------------------------------------ this expression has type `indexmap::map::core::Entry<'_, std::string::String, schemars::schema::Schema>`
...
72 |                             Entry::Vacant(entry) => {
   |                             ^^^^^^^^^^^^^^^^^^^^ expected enum `indexmap::map::core::Entry`, found enum `std::collections::btree_map::Entry`
   |
   = note: expected enum `indexmap::map::core::Entry<'_, std::string::String, schemars::schema::Schema>`
              found enum `std::collections::btree_map::Entry<'_, _, _>`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `kube-core` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

This is a problem with kube-core.
They hard code the type in there schema.rs file.
But this type changes with the preserve_order flag in schemars.

This line:
https://github.com/kube-rs/kube/blob/b92dc5ba25b0ab91c979b0dfe5cb9306ba157def/kube-core/src/schema.rs#L5

Should be changed to:

use schemars::MapEntry as Entry;

or just use schemars::MapEntry; and change the match lower down in the code (line 104-114).

Transferred issue to kube-rs.
kube-rs/kube#1049

Thanks for reporting. I'll close the issue here.