schemars icon indicating copy to clipboard operation
schemars copied to clipboard

Just can't enable smol_str feature

Open Smotrov opened this issue 2 years ago • 1 comments

Regardless the fact that cargo.toml has smol_str enabled for the crate schemars = { version = "0.8.16", features = ["smol_str", "chrono"] }

it still doesn't works with struct containing this type

error[E0277]: the trait bound `SmolStr: JsonSchema` is not satisfied
   --> csv_parser/src/parser/result_json.rs:107:25
    |
107 |     pub schema_version: SmolStr,
    |                         ^^^^^^^ the trait `JsonSchema` is not implemented for `SmolStr`
    |
    = help: the following other types implement trait `JsonSchema`:
              bool
              char
              isize
              i8
              i16
              i32
              i64
              i128
            and 137 others
note: required by a bound in `SchemaGenerator::subschema_for`
   --> /Users/smotrov/.cargo/registry/src/index.crates.io-6f17d22bba15001f/schemars-0.8.16/src/gen.rs:221:38
    |
221 |     pub fn subschema_for<T: ?Sized + JsonSchema>(&mut self) -> Schema {
    |                                      ^^^^^^^^^^ required by this bound in `SchemaGenerator::subschema_for`

Smotrov avatar Nov 28 '23 16:11 Smotrov

Which version of smol_str are you using? Schemars 0.8.21 only supports smol_str ^0.1.17 (i.e. 0.1.X). Schemars 1.0.0-alpha.3 supports smol_str ^0.2.1 (i.e. 0.2.X) via the smol_str02 feature flag

GREsau avatar Aug 12 '24 10:08 GREsau