-
Notifications
You must be signed in to change notification settings - Fork 0
Bump schemars to version 1 #243
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: hombit <1784493+hombit@users.noreply.github.com>
Co-authored-by: hombit <1784493+hombit@users.noreply.github.com>
hombit
left a comment
There was a problem hiding this 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 Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
Co-authored-by: hombit <1784493+hombit@users.noreply.github.com>
Simplified using schemars 1.x Note: 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:
If you need me to access, download, or install something from one of these locations, you can either:
|
hombit
left a comment
There was a problem hiding this 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>
The Only 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:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Blocked by reem/rust-ordered-float#174 or GREsau/schemars#484 |
Updates schemars from 0.8 to 1.x, adapting to the breaking API changes in the new major version.
Changes Made
Dependency Updates
schemars = "^1"in Cargo.tomlordered-floatto use a git dependency with schemars 1.x support (pending reem/rust-ordered-float#174)API Migration
schemars::gen::SchemaGenerator→schemars::SchemaGenerator,schemars::schema::Schema→schemars::Schemais_referenceable()→inline_schema()with inverted logicschema_name()return type fromStringtoCow<'static, str>Code Simplification
Leveraged schemars 1.x
#[schemars(with = "...")]attribute to replace manualJsonSchemaimplementations and remove thejson_schema!macro entirely:FitArray,IndComponentsLnPriorBeyondNStd,InterPercentileRange,Bins,MedianBufferRangePercentagePercentDifferenceMagnitudePercentile,PeriodogramPeaks,PeriodogramPeriodogramPowerFft,FeatureExtractorThis removes ~80 lines of boilerplate code.
Note:
SortedArrayandTransformedstill require manualimpl JsonSchema-SortedArraybecauseArray1<T>from ndarray doesn't implementJsonSchema, andTransformeddue to complex trait bounds that cannot be expressed in schemars attributes.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.