Skip to content

Commit

Permalink
chore: use IndexMap instead of BTreeMap
Browse files Browse the repository at this point in the history
  • Loading branch information
raimundo-henriques committed Sep 30, 2024
1 parent 5cdc5f4 commit 9e3b574
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
use std::collections::{BTreeMap, BTreeSet};

use chrono::{DateTime, Utc};
use indexmap::IndexMap;
use rust_decimal::Decimal;
use schemars::schema::{
ArrayValidation, InstanceType, NumberValidation, ObjectValidation, Schema,
SchemaObject, SingleOrVec, StringValidation,
ArrayValidation, InstanceType, NumberValidation, ObjectValidation, Schema, SchemaObject,
SingleOrVec, StringValidation,
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -896,7 +897,7 @@ impl<T: JsonSchema> JsonSchema for DataModelExtension<T> {
}

fn json_schema(_gen: &mut schemars::gen::SchemaGenerator) -> Schema {
let mut properties = BTreeMap::new();
let mut properties = IndexMap::new();
properties.insert(
"data".to_string(),
Schema::Object(SchemaObject {
Expand Down Expand Up @@ -933,6 +934,7 @@ impl<T: JsonSchema> JsonSchema for DataModelExtension<T> {
..Default::default()
}),
);
let properties = BTreeMap::from_iter(properties.into_iter());
let schema_object = SchemaObject {
instance_type: Some(InstanceType::Object.into()),
object: Some(Box::new(ObjectValidation {
Expand Down

0 comments on commit 9e3b574

Please sign in to comment.