use rovo::aide::axum::IntoApiResponse;
use rovo::extract::{Path, State};
use rovo::response::Json;
use rovo::schemars::JsonSchema;
use rovo::{routing::get, rovo, Router};
use serde::Deserialize;
use uuid::Uuid;
#[derive(Clone)]
struct AppState {
}
#[derive(Clone, Debug, serde::Serialize, JsonSchema, PartialEq)]
struct TodoItem {
id: Uuid,
description: String,
complete: bool,
}
impl Default for TodoItem {
fn default() -> Self {
Self {
id: Uuid::nil(),
description: "fix bugs".into(),
complete: false,
}
}
}
#[derive(Deserialize, JsonSchema)]
struct SelectTodo {
#[allow(dead_code)]
id: Uuid,
}
#[rovo]
async fn get_todo(
State(_app): State<AppState>,
Path(_todo): Path<SelectTodo>,
) -> impl IntoApiResponse {
Json(TodoItem::default())
}
#[test]
fn test_macro_compiles() {
let _state = AppState {};
let _router: ::axum::Router = Router::<AppState>::new()
.route("/todo/{id}", get(get_todo))
.with_state(_state)
.finish();
}