Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 4, 2025

Updates schemars from 0.8 to 1.x, adapting to the breaking API changes in the new major version.

Changes Made

Dependency Updates

  • Updated schemars = "^1" in Cargo.toml
  • Updated ordered-float to use a git dependency with schemars 1.x support (pending reem/rust-ordered-float#174)

API Migration

  • Updated imports: schemars::gen::SchemaGeneratorschemars::SchemaGenerator, schemars::schema::Schemaschemars::Schema
  • Updated is_referenceable()inline_schema() with inverted logic
  • Updated schema_name() return type from String to Cow<'static, str>

Code Simplification

Leveraged schemars 1.x #[schemars(with = "...")] attribute to replace manual JsonSchema implementations and remove the json_schema! macro entirely:

  • FitArray, IndComponentsLnPrior
  • BeyondNStd, InterPercentileRange, Bins, MedianBufferRangePercentage
  • PercentDifferenceMagnitudePercentile, PeriodogramPeaks, Periodogram
  • PeriodogramPowerFft, FeatureExtractor

This removes ~80 lines of boilerplate code.

Note: SortedArray and Transformed still require manual impl JsonSchema - SortedArray because Array1<T> from ndarray doesn't implement JsonSchema, and Transformed due to complex trait bounds that cannot be expressed in schemars attributes.

Original prompt

Bump schemars to version 1


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 4, 2025 22:52
Co-authored-by: hombit <1784493+hombit@users.noreply.github.com>
Co-authored-by: hombit <1784493+hombit@users.noreply.github.com>
Copilot AI changed the title [WIP] Update schemars to version 1 Bump schemars to version 1 Dec 4, 2025
Copilot AI requested a review from hombit December 4, 2025 22:58
Copy link
Member

@hombit hombit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot, very nice. Now please see if any code can be simplified or removed with this new version

@codecov
Copy link

codecov bot commented Dec 5, 2025

Codecov Report

❌ Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.05%. Comparing base (73d85bd) to head (39d6d71).

Files with missing lines Patch % Lines
src/features/transformed.rs 0.00% 9 Missing ⚠️
src/sorted_array.rs 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #243      +/-   ##
==========================================
+ Coverage   89.82%   90.05%   +0.23%     
==========================================
  Files          77       77              
  Lines        6503     6486      -17     
==========================================
  Hits         5841     5841              
+ Misses        662      645      -17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: hombit <1784493+hombit@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 5, 2025

@copilot, very nice. Now please see if any code can be simplified or removed with this new version

Simplified using schemars 1.x #[schemars(with = "...")] attribute to replace manual JsonSchema implementations for FitArray and IndComponentsLnPrior (removed ~30 lines of code). Commit: 17e3c78

Note: SortedArray still needs a manual implementation since Array1<T> from ndarray doesn't implement JsonSchema.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https zstd/lib/common -I zstd/lib/legacy -fvisibility=hidden d-sys-08634d800a184fe1/out/libzstd.a d-sys-08634d800a184fe1/out/44ff4c55aa9e5133-debug.o d-sys-08634d800a184fe1/out/44ff4c55aa9e5133-entropy_common.o d-sys-08634d800a184fe1/out/44ff4c55aa9e5133-error_private.o d-sys-08634d800a184fe1/out/44ff4c55aa9e5133-fse_decompress.o d-sys-08634d800a184fe1/out/44ff4c55aa9e5133-pool.o d-sys-08634d800a184fe1/out/44ff4c55aa9e5133-threading.o d-sys-08634d800a184fe1/out/44ff4c55aa9e5133-zstd_common.o d-sys-08634d800a184fe1/out/fb80479a5fb81f6a-fse_compress.o d-sys-08634d800a184fe1/out/fb80479a5fb81f6a-hist.o d-sys-08634d800a184fe1/out/fb80479a5fb81f6a-huf_compress.o d-sys-08634d800a184fe1/out/fb80479a5fb81f6a-zstd_compress.o d-sys-08634d800a184fe1/out/fb80479a5fb81f6a-zstd_compress_literals.o d-sys-08634d800a184fe1/out/fb80479a5fb81f6a-zstd_compress_sequences.o d-sys-08634d800a184fe1/out/fb80479a5fb81f6a-zstd_compress_superblock.o (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from hombit December 5, 2025 18:30
Copy link
Member

@hombit hombit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Do we still need json_schema macro?

Co-authored-by: hombit <1784493+hombit@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 5, 2025

@copilot Do we still need json_schema macro?

The json_schema! macro has been removed. Most types now use #[derive(JsonSchema)] with #[schemars(with = "...")] attribute instead. Commit: 39d6d71

Only Transformed still needs a manual impl JsonSchema due to its complex trait bounds that can't be expressed in schemars attributes.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https .. --64 /x86_64-linux-gn--eh-frame-hdr -f plan-dft.o .libs/plan-dft.o--hash-style=gnu { print &#34;f&#34;, $3 &#34;/&#34; $4, $1; } } \ END { for (d in files) print &#34;f&#34;, d, files[d] } plan-dft.loT (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from hombit December 5, 2025 18:55
@hombit
Copy link
Member

hombit commented Dec 5, 2025

Blocked by reem/rust-ordered-float#174 or GREsau/schemars#484

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.

2 participants