Derive Macro apistos::ApiComponent

source ยท
#[derive(ApiComponent)]
Expand description

Generates a reusable OpenAPI schema.

This #[derive] macro should be used in combination with api_operation.

This macro requires your type to derive JsonSchema.

use apistos::ApiComponent;
use schemars::JsonSchema;
use garde::Validate;

#[derive(Debug, Clone, JsonSchema, ApiComponent, Validate)]
pub(crate) struct QueryTag {
  #[garde(length(min = 2))]
  #[schemars(length(min = 2))]
  pub(crate) tags: Vec<String>,
}

Because this macro requires JsonSchema, all attributes supported by JsonSchema are forwarded to this implementation.