GREsau / schemars

Generate JSON Schema documents from Rust code
https://graham.cool/schemars/
MIT License
840 stars 229 forks source link

Just can't enable smol_str feature #256

Open Smotrov opened 12 months ago

Smotrov commented 12 months ago

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`
GREsau commented 3 months ago

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