From ff02e3c06ba3e500a95a36358d58e02b74975cdb Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 8 Feb 2020 12:47:36 +0100 Subject: [PATCH] add OpenapiType for BTreeSet and HashSet --- gotham_restful/src/openapi/types.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gotham_restful/src/openapi/types.rs b/gotham_restful/src/openapi/types.rs index b04dd56..3b29c59 100644 --- a/gotham_restful/src/openapi/types.rs +++ b/gotham_restful/src/openapi/types.rs @@ -9,6 +9,7 @@ use openapiv3::{ }; #[cfg(feature = "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 @@ -273,6 +274,22 @@ impl OpenapiType for Vec } } +impl OpenapiType for BTreeSet +{ + fn schema() -> OpenapiSchema + { + as OpenapiType>::schema() + } +} + +impl OpenapiType for HashSet +{ + fn schema() -> OpenapiSchema + { + as OpenapiType>::schema() + } +} + #[cfg(feature = "chrono")] str_types!(format = Date, Date, Date, Date, NaiveDate); #[cfg(feature = "chrono")]