Skip to content

Commit

Permalink
Add missing type for array
Browse files Browse the repository at this point in the history
  • Loading branch information
rlebran committed Dec 1, 2023
1 parent f226e60 commit 79eff92
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apistos-core/src/api_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use apistos_models::paths::{MediaType, Parameter, RequestBody, Response, Respons
use apistos_models::reference_or::ReferenceOr;
use apistos_models::security::SecurityScheme;
use apistos_models::Schema;
use schemars::schema::{ArrayValidation, SchemaObject};
use schemars::schema::{ArrayValidation, InstanceType, SchemaObject, SingleOrVec};
use std::collections::BTreeMap;
#[cfg(feature = "actix")]
use std::future::Future;
Expand Down Expand Up @@ -127,6 +127,7 @@ where
(
name,
ReferenceOr::Object(Schema::Object(SchemaObject {
instance_type: Some(SingleOrVec::Single(Box::new(InstanceType::Array))),
array: Some(Box::new(ArrayValidation {
items: Some(Schema::new_ref(_ref).into()),
..Default::default()
Expand Down Expand Up @@ -361,6 +362,7 @@ mod test {
assert_json_eq!(
json,
json!({
"type": "array",
"items": {
"$ref": "#/components/schemas/Test"
}
Expand Down

0 comments on commit 79eff92

Please sign in to comment.