Skip to content

Plan to upgrade to schemars 1.0 #886

Open

Description

@h7kanna

schemars made a significant breaking change from 0.8.x to 1.0.x.

Is there any consideration to upgrade to it?

Migration notice : https://graham.cool/schemars/migrating/

Activity

  1. eveeifyeve commented on Sep 13, 2025

    @eveeifyeve

    It's a lot of complex they removed metadata and all of the schemars::schema options.

  2. dzmitry-lahoda commented on Sep 13, 2025

    @dzmitry-lahoda

    #737 seems have some basics needed for upgrade

  3. fulmen3000 commented on Sep 13, 2025

    @fulmen3000

    I recently also bumped into a schema that is not parsable by schemars 0.8, but it works with 1.0. Don't know the cause yet, but this also made me wonder why typify has not upgraded.

    In #737 @ahl commented a little on this, moving in another direction, but that seems a lot of work compared to upgrading?

    Is there something else blocking this? Like has schemars removed information needed by typify to work? Again, I've just started to investigate, so I'm still very ignorant. But I would like to have a crate like typify to 'just work', these are the gems we need for Rust to mature.

  4. eveeifyeve commented on Sep 13, 2025

    @eveeifyeve

    There is a blocker with schemars because a lot was changed in 0.8 to 1.0 with the removal of type objects replaced by the Schema Struct.

  5. eveeifyeve commented on Sep 13, 2025

    @eveeifyeve

    I am working hard on fixing this but however it's a huge migration.

  6. fulmen3000 commented on Sep 13, 2025

    @fulmen3000

    Very good to hear, what is the general direction of your fix?

    1. migrating to schemars 1.0
    2. 'copy paste bad design and maintain it' as @dzmitry-lahoda put it
    3. a major rework as suggested by @ahl
  7. eveeifyeve commented on Sep 13, 2025

    @eveeifyeve

    Very good to hear, what is the general direction of your fix?

    1. migrating to schemars 1.0
    
    2. 'copy paste bad design and maintain it' as [@dzmitry-lahoda](https://github.com/dzmitry-lahoda) put it
    
    3. a major rework as suggested by [@ahl](https://github.com/ahl)
    
    1. A major rework.
  8. balisujohn commented on Sep 13, 2025

    @balisujohn

    @eveeifyeve Interested in helping accelerate this. If some part of this is neatly separable and can be done in parallel, let me know.

  9. ahl commented on Sep 15, 2025

    @ahl
    Collaborator

    I'm curious about the interest here. Typify has--effectively--two uses of schemars:

    1. It uses schemars for (not very accurate) parsing and internal representation of JSON Schema
    2. It emits code that derives schemars::JsonSchema for types

    For 1, there's no migration as those structures have been removed. We will roll our own IR. For 2, I'd just like to make sure we can support consumers who depend on schemars 1.0 or 0.8 (or maybe both).

    Are folks interested in this because they want generated code to implement schemars::JsonSchema from version 1.0?

  10. fulmen3000 commented on Sep 15, 2025

    @fulmen3000

    @ahl The interest on my part is mostly because of point 1, generating Rust types from an existing json-schema that allows for parsing and interacting with data structures without resorting to 'magic' strings etc. The generated builders additionally allow for better written tests as well. Using a crate like jsonschema supports typify very well by allowing for independent schema-validation of source or generated structures.

    As for upgrading schemars, that was because typify was full circle brilliant because you can do schema -> Rust -> schema. But as schemars has essentially removed the internal representation information one needs to do schema -> Rust, I don't really trust this to generate the same result Rust -> schema. Ergo, I'm not looking for point 2 specifically.

  11. h7kanna commented on Sep 16, 2025

    @h7kanna
    Author

    I had structs implement the Schema (option 2), strictly not needed!

    let mut type_space = TypeSpace::new(
            TypeSpaceSettings::default()
                .with_struct_builder(true)
                .with_derive("schemars::JsonSchema".to_string()),
        );
        type_space.add_ref_types(schema.definitions).unwrap();
    
  12. eveeifyeve commented on Sep 17, 2025

    @eveeifyeve

    I'm curious about the interest here. Typify has--effectively--two uses of schemars:

    1. It uses schemars for (not very accurate) parsing and internal representation of JSON Schema
    
    2. It emits code that derives `schemars::JsonSchema` for types
    

    For 1, there's no migration as those structures have been removed. We will roll our own IR. For 2, I'd just like to make sure we can support consumers who depend on schemars 1.0 or 0.8 (or maybe both).

    Are folks interested in this because they want generated code to implement schemars::JsonSchema from version 1.0?

    This will have to be a breaking change. Users can migrate or stay to a previous version if they use 0.8 for open api 3.0 for users, for 3.1 won't have a choice but sept to migrate.

  13. added
    typify2
    on Nov 17, 2026
  14. marked schemars deprecated schemas #737 as a duplicate of this issue on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    typify2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions