Skip to content

Conversation

@StefanTerdell
Copy link

Not sure how this ties in to your planned release schedule or if you consider this a breaking change, so please let me know if you want me to try and feature gate the versioning (not sure if that's possible, come to think of it).

Anyway, it just does what it says on the tin: bumps schemars to 1.*.

@StefanTerdell StefanTerdell changed the title Bump schemars dependency to 1.*.* Backwards compatible schemars 1.* support using version specific features Oct 23, 2025
@StefanTerdell
Copy link
Author

I've updated the pull request to add feature-gated support for both Schemars v0.8 and v1. I also made Schemars optional by creating a separate feature for Serde. The json feature is completely backwards compatible by aliasing the schemars08 feature, which in turn requires the serde feature.

@krisprice
Copy link
Owner

Thanks. Slightly nitty (and slightly annoying) - but does changing the name of the schemars dependency to schemars08 break semver? Like - I have no idea who is using this - but conceivably someone could be using ipnet = {features = ["serde", "schemars"]} instead of the json feature and now they'll need to update to schemars08.

@StefanTerdell
Copy link
Author

StefanTerdell commented Nov 18, 2025

Nice catch, @krisprice. I've addressed this along with some admittedly opinion-based changes in a couple of new commits. In short:

  1. schemars-feature added, aliasing schemars08
  2. schemars1-feature is now no_std compatible
  3. schemars1 and schemars08 features no longer imply serde (but json explicitly does)
  4. Added a heapless feature that does imply serde, as ser_as_str does nothing without it. As I type this out I realise someone, somewhere might have enabled the heapless dependency directly without enabling serde, but it shouldn't be able to break anything as the default features are disabled (in other words, serde won't pull in std).
  5. Expanded the "# Serde" section of the lib.rs-module docs into a "# Features" section.
  6. "Deprecated" some features for the next major release. As the list is growing I thought it might be helpful to be a bit strict about naming and keeping them linked to specific dependencies, but this is obviously only based on my opinion alone. Let me know if you want me to remove this change.

@freexploit
Copy link

Is there any test need for this? I need this feature, to fix a compatibility issue with https://github.com/kube-rs/kube

@StefanTerdell
Copy link
Author

Hello @krisprice!

I restructured the git history a bit to conserve the history of the original schemars support implementation and force pushed it. This should make the PR a bit easier to review. Hope this helps!

Let me know if there is anything you'd like to see added, removed or changed. Thanks :)

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

Successfully merging this pull request may close these issues.

3 participants