Add OpenAPI documentation via Utoipa

Annotates all API handlers and model structs with Utoipa macros to generate
an OpenAPI 3.0 spec at runtime. Serves an interactive Swagger UI at /api/docs
and the raw JSON spec at /api/docs/openapi.json, both publicly accessible
outside the auth middleware.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
rzuasti
2026-05-27 13:36:05 -04:00
co-authored by Claude Sonnet 4.6
parent 6002597383
commit 44d593fccc
7 changed files with 392 additions and 6 deletions
+3 -1
View File
@@ -2,13 +2,15 @@ use crate::utils::date_serializer;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use std::fmt;
use utoipa::ToSchema;
#[derive(Clone, Serialize, Deserialize)]
#[derive(Clone, Serialize, Deserialize, ToSchema)]
pub struct Device {
pub mac_address: String,
pub ipv4_address: String,
pub vendor: String,
#[serde(with = "date_serializer")]
#[schema(value_type = String, format = DateTime)]
pub last_seen: DateTime<Utc>,
pub is_registered: bool,
pub owner: String,