Derive Macro apistos::ApiCookie

source ·
#[derive(ApiCookie)]
{
    // Attributes available to this derive:
    #[openapi_cookie]
}
Expand description

Generates a reusable OpenAPI parameter schema in cookie.

This #[derive] macro should be used in combination with api_operation. The macro requires one and only one openapi_cookie.

This macro requires your type to derive JsonSchema.

use apistos::ApiCookie;
use schemars::JsonSchema;

#[derive(Debug, Clone, JsonSchema, ApiCookie)]
#[openapi_cookie(
  name = "X-Organization-Slug",
  description = "Organization of the current caller",
  required = true
)]
pub struct OrganizationSlugCookie(String);
  • name = "..." a required parameter with the header name
  • description = "..." an optional description for the header
  • required = false an optional parameter, default value is false
  • deprecated = false an optional parameter, default value is false

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