Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ ndarray = { version = "^0.16", features = ["serde"] }
ndarray-stats = "^0.6"
num-complex = "^0.4" # the same version as used by fftw
num-traits = "^0.2"
ordered-float = { version = "5", features = ["serde", "schemars"] }
# Using git dependency until ordered-float releases schemars 1.x support (see https://github.com/reem/rust-ordered-float/pull/174)
ordered-float = { git = "https://github.com/mdepta42/rust-ordered-float", rev = "3e80f4219129ae98b2d29ec58286f754cd17a254", features = ["serde", "schemars"] }
paste = "1"
schemars = "^0.8"
schemars = "^1"
serde = { version = "1", features = ["derive"] }
thiserror = "2"
thread_local = "1.1"
Expand Down
8 changes: 4 additions & 4 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ macro_rules! transformer_eval {
/// Helper implementing JsonSchema crate
macro_rules! json_schema {
($parameters: ty, $is_referenceable: expr) => {
fn is_referenceable() -> bool {
$is_referenceable
fn inline_schema() -> bool {
!$is_referenceable
}

fn schema_name() -> String {
fn schema_name() -> std::borrow::Cow<'static, str> {
<$parameters>::schema_name()
}

fn json_schema(r#gen: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
fn json_schema(r#gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
<$parameters>::json_schema(r#gen)
}
};
Expand Down
8 changes: 4 additions & 4 deletions src/nl_fit/evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ impl<T, const NPARAMS: usize> JsonSchema for FitArray<T, NPARAMS>
where
T: schemars::JsonSchema,
{
fn is_referenceable() -> bool {
false
fn inline_schema() -> bool {
true
}

fn schema_name() -> String {
fn schema_name() -> std::borrow::Cow<'static, str> {
FitArraySerde::<T>::schema_name()
}

fn json_schema(r#gen: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
fn json_schema(r#gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
FitArraySerde::<T>::json_schema(r#gen)
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/nl_fit/prior/ln_prior.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ impl<const NPARAMS: usize> LnPriorTrait<NPARAMS> for IndComponentsLnPrior<NPARAM
}

impl<const NPARAMS: usize> JsonSchema for IndComponentsLnPrior<NPARAMS> {
fn is_referenceable() -> bool {
false
fn inline_schema() -> bool {
true
}

fn schema_name() -> String {
fn schema_name() -> std::borrow::Cow<'static, str> {
IndComponentsLnPriorSerde::schema_name()
}

fn json_schema(r#gen: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
fn json_schema(r#gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
IndComponentsLnPriorSerde::json_schema(r#gen)
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/sorted_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use crate::error::SortedArrayError;
use crate::float_trait::Float;
use conv::prelude::*;
use ndarray::{Array1, ArrayView1};
use schemars::schema::Schema;
use schemars::{JsonSchema, r#gen::SchemaGenerator};
use schemars::{JsonSchema, Schema, SchemaGenerator};
use serde::{Deserialize, Serialize};
use std::borrow::Cow;
use std::ops::Deref;

// Underlying array is guaranteed to be sorted and contiguous
Expand Down Expand Up @@ -115,12 +115,12 @@ impl<T> JsonSchema for SortedArray<T>
where
T: JsonSchema,
{
fn is_referenceable() -> bool {
false
fn inline_schema() -> bool {
true
}

fn schema_name() -> String {
"SortedArray".to_string()
fn schema_name() -> Cow<'static, str> {
Cow::Borrowed("SortedArray")
}

fn json_schema(generator: &mut SchemaGenerator) -> Schema {
Expand Down
Loading