Closed campbellcole closed 4 months ago
When schemars/preserve_order is enabled, the Map type alias used in e.g. ObjectValidation::properties switches from BTreeMap to IndexMap, and IndexMap::append does not exist, causing this line to fail compilation: https://github.com/jonasbb/serde_with/blob/2274dd142afbd6788ad43cba7f66710af78c4e03/serde_with/src/schemars_0_8.rs#L573
schemars/preserve_order
Map
ObjectValidation::properties
BTreeMap
IndexMap
IndexMap::append
This feature is enabled by default by rocket_okapi which is how I encountered this: https://github.com/GREsau/okapi/blob/cd59fb61c5c8db1ce1976cb782efd544d8f99c38/rocket-okapi/Cargo.toml#L33-L36
rocket_okapi
I don't know off the top of my head what method IndexMap has that is equivalent to BTreeMap::append but I'd imagine this feature can be checked or a notice in the documentation could point out this incompatibility.
BTreeMap::append
Thanks
Thanks for reporting that. It is a bit unfortunate that the API differs here. I have a fix in #764 and tested it manually.
When
schemars/preserve_order
is enabled, theMap
type alias used in e.g.ObjectValidation::properties
switches fromBTreeMap
toIndexMap
, andIndexMap::append
does not exist, causing this line to fail compilation: https://github.com/jonasbb/serde_with/blob/2274dd142afbd6788ad43cba7f66710af78c4e03/serde_with/src/schemars_0_8.rs#L573This feature is enabled by default by
rocket_okapi
which is how I encountered this: https://github.com/GREsau/okapi/blob/cd59fb61c5c8db1ce1976cb782efd544d8f99c38/rocket-okapi/Cargo.toml#L33-L36I don't know off the top of my head what method
IndexMap
has that is equivalent toBTreeMap::append
but I'd imagine this feature can be checked or a notice in the documentation could point out this incompatibility.Thanks