Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just can't enable smol_str feature #256

Open
Smotrov opened this issue Nov 28, 2023 · 1 comment
Open

Just can't enable smol_str feature #256

Smotrov opened this issue Nov 28, 2023 · 1 comment

Comments

@Smotrov
Copy link

Smotrov commented Nov 28, 2023

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
Copy link
Owner

GREsau commented Aug 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants