1
0
Fork 0
mirror of https://gitlab.com/msrd0/gotham-restful.git synced 2025-02-23 04:52:28 +00:00

add OpenapiType for BTreeSet and HashSet

This commit is contained in:
Dominic 2020-02-08 12:47:36 +01:00
parent 9d21ea9cce
commit ff02e3c06b
Signed by: msrd0
GPG key ID: DCC8C247452E98F9

View file

@ -9,6 +9,7 @@ use openapiv3::{
}; };
#[cfg(feature = "uuid")] #[cfg(feature = "uuid")]
use uuid::Uuid; use uuid::Uuid;
use std::collections::{BTreeSet, HashSet};
/** /**
This struct needs to be available for every type that can be part of an OpenAPI Spec. It is This struct needs to be available for every type that can be part of an OpenAPI Spec. It is
@ -273,6 +274,22 @@ impl<T : OpenapiType> OpenapiType for Vec<T>
} }
} }
impl<T : OpenapiType> OpenapiType for BTreeSet<T>
{
fn schema() -> OpenapiSchema
{
<Vec<T> as OpenapiType>::schema()
}
}
impl<T : OpenapiType> OpenapiType for HashSet<T>
{
fn schema() -> OpenapiSchema
{
<Vec<T> as OpenapiType>::schema()
}
}
#[cfg(feature = "chrono")] #[cfg(feature = "chrono")]
str_types!(format = Date, Date<FixedOffset>, Date<Local>, Date<Utc>, NaiveDate); str_types!(format = Date, Date<FixedOffset>, Date<Local>, Date<Utc>, NaiveDate);
#[cfg(feature = "chrono")] #[cfg(feature = "chrono")]