pub mod asyncapi;
pub mod compat;
pub mod dialect;
pub mod graphql;
pub mod mcp;
pub mod openapi;
pub mod probe;
pub mod proto;
pub mod providers;
pub mod reconcile;
pub mod schema;
pub mod serialize;
#[derive(Debug, Clone, PartialEq)]
pub struct DeclaredOp {
pub operation: String,
pub method: String,
pub path: String,
}
#[derive(Debug, Clone)]
pub struct RouteDecl {
pub id: String,
pub operation: String,
pub method: String,
pub path: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SpecKind {
OpenApi,
AsyncApi,
GraphQl,
McpTools,
}
pub fn sniff_kind(filename: &str, text: &str) -> Option<SpecKind> {
if filename.ends_with(".graphql") || filename.ends_with(".sdl") {
return Some(SpecKind::GraphQl);
}
let head: String = text.chars().take(2000).collect();
if head.contains("asyncapi") {
Some(SpecKind::AsyncApi)
} else if head.contains("openapi") || head.contains("swagger") {
Some(SpecKind::OpenApi)
} else if head.contains("\"tools\"") {
Some(SpecKind::McpTools)
} else if head.contains("type Query") || head.contains("type Mutation") {
Some(SpecKind::GraphQl)
} else {
None
}
}