use axum::{ Json, extract::State, http::StatusCode, response::{IntoResponse, Response}, }; use pile_dataset::Datasets; use std::{collections::HashMap, sync::Arc}; pub use pile_config::FieldSpec; pub type FieldsResponse = HashMap; /// Retrieve this dataset's schema. #[utoipa::path( get, path = "/config/schema", responses( (status = 200, description = "This dataset's schema"), ) )] pub async fn config_schema(State(state): State>) -> Response { let fields: FieldsResponse = state .config .schema .iter() .map(|(k, v)| (k.as_str().to_owned(), v.clone())) .collect(); (StatusCode::OK, Json(fields)).into_response() }